I’m trying to filter an Ontology object and one of my filter is a preset date.
My question is, how can I use Filter on my object parameter (Timestamp) to get only those which have object.date >= SomeDate
Note that if a zone offset is not explicitly specified as part of the input string (as in the above example), Timestamp.fromISOString will assume that the string represents the time in UTC.
In normal use, the Timestamp type in the Ontology represents a Unix time number, like Postgres TIMESTAMP WITH TIME ZONE, and therefore it’s not straightforward to express a filter like “include all data after 10 AM on 2024-10-02 in that data’s local timezone” as a filter on an Ontology Timestamp property when different object instances represent data in different timezones. Storing the equivalent of a Postgres TIMESTAMP WITHOUT TIME ZONE in a Timestamp property may allow you to achieve this behavior, but it would come with drawbacks, such as violating assumptions made by Foundry front-ends that the value is indeed a Unix time number. There is a good answer on Stack Overflow that explains these concepts in the context of Postgres.
However, I infer from the language of your original question that your specific need is to filter to all data for which the date part of a Timestamp in that Timestamp’s local time zone is after a specific calendar date. If that’s correct, the standard convention in Ontology design is to have two separate properties - a Timestamp that stores the Unix time number, and a Date that represents the calendar date in the time zone associated with the data. You can then express the filter using the below code: