Using IsDateOnly property (IBM Content Cortex)
(For administrators only) With the IsDateOnly property, you can set your documents with a date only value, which is not changed by the time zone of any country. This property is available in Content Navigator 3.0.10 with Content Platform Engine 5.2.1 or later.
You might want to use the date of the Date property and not be affected by the time or time zone. Birthday dates are an example of dates that are not to be affected by the time or time zone. For example, a user in the United States enters 6/23/2021 (June 23, 2021) and saves that value in the Date property. A user in Beijing, China sees the same date in their locale format.
- Requirements
- The Content Platform Engine's DateTime property must have the IsDateOnly property set to True to use the date-only feature. The default is False. You can enable IsDateOnly on properties that are not system-owned properties.
- Setting, updating, and retrieving Date only properties
-
- For Date properties that have the IsDateOnly attribute set to True, the IBM® Content Navigator sets the value as a Date object with the time portion set to 12:00 noon Coordinated Universal Time.
- The value is displayed without the time information. For example, 6/23/2021 (June 23, 2021).
- When you update properties like the Document Title on an existing document, and you do not change the date values, those values are not updated.
Note: If you want to keep the same date but you want to update the Date-only property value to 12 noon Coordinated Universal Time, you need to:- Open the Date Picker, set a different date and save it.
- Then, open the Date Picker again, set the date to the original date, and save it.
Searching with Date only properties
- When you run a search with criteria that have date-only properties, the IBM Content Navigator is running an exact-value search instead of the 24-hour range
search as before. For example, if you specify in the search criteria to search for all documents
that have BirthdayField = 6/23/2021 (June 23, 2021),
then part of the WHERE clause in the queries are: Exact-day search,
t.[BirthdayField] = 2021-06-23T12:00:00.000Instead of the 24-hour range search,t.[BirthdayField] >= 2021-06-23T08:00:00.000Z AND t.[BirthdayField]< 2021-06-24T08:00:00.000Z - When you open an existing search, the server normalizes the date-only property’s criteria value
to 12 noon Coordinated Universal Time before it is sent to the client.For example,
"searchCriteria": [{ "itemId": "", "displayValues": [], "hasSelectedOperators": false, "hidden": false, "dataType": "xs:date", "values": ["2021-02-23T12:00:00.000", ""], "name": "BirthdayField", "selectedOperator": "EQUAL", "readOnly": false, "id": "BirthdayField", "cardinality": "SINGLE", "required": false } ], - When you save a search, all the search criteria is saved, which includes criteria that is not modified. Criteria that have date-only properties have their values be normalized to 12:00 noon Coordinated Universal Time.
- When you search for content across multiple repositories and you map a property
to another property, the properties are treated as a single property in the cross-repository search.
- If both properties in the mapping pair are a date-only type, then the search criteria value is normalized to 12:00 noon Coordinated Universal Time. The IBM Content Navigator uses the normalized value to search each repository.
-
If one property has the IsDateOnly flag that is enabled and the other property does not, then the search criteria value is not normalized to 12:00 noon Coordinated Universal Time. In this case, notice that if the search is opened in a different time zone, the value might be shifted and displayed a day earlier or a day later. However, when the search is run, IBM Content Navigator uses the value that is normalized at 12:00 noon Coordinated Universal Time for the date-only property to search in one repository. Content Navigator also uses the as-is value for the other property to search in another repository.
Scenario:- A user from Beijing creates a cross-repository search with a pair of mapping properties. One
property has the IsDateOnly flag that is enabled and the other property does
not. Use the Calendar Date Picker and select a date for the search criteria. For example, select
02/23/2021 (February 23, 2021). When the search is saved, the search criteria
value is saved as
2021-02-23T00:00:00.000+08:00. -
From California, a different user opens the search and the search criteria is displayed as 2/22/2021 (February 22, 2021) in the editor box.
When the search is run, two queries are issued:t.[BirthdayField] = 2021-02-23T12:00:00.000(query for the date-only property in one repository)t.[PromotionDay] >= 2021-02-22T16:00:00.000Z AND t.[PromotionDay] < 2021-02-23T16:00:00.000Z(query for the non-date-only property in another repository)
- A user from Beijing creates a cross-repository search with a pair of mapping properties. One
property has the IsDateOnly flag that is enabled and the other property does
not. Use the Calendar Date Picker and select a date for the search criteria. For example, select
02/23/2021 (February 23, 2021). When the search is saved, the search criteria
value is saved as
Recommendations
- Users are advised to create a new property for date-only values and set the attribute IsDateOnly to True before assigning the property to a class.
- If users have existing data with Date properties that have IsDateOnly flag
that is enabled, they are advised to update their existing data to use the 12:00 noon Coordinated
Universal Time convention. If they chose not to update their data, they might have unexpected
results in the following areas:
- Wherever the value is displayed in the UI, users might see that the value is shifted and displayed a day earlier or a day after dependent on the time zone.
- When you run searches, you might have different results than what you expect. The server does an exact search for date-only properties instead of doing a 24-hour range search.
Custom plug-ins and other client services that are integrated with Content Navigator
- The plug-in service or FileNet P8 client that is integrated with Content Navigator, which retrieves or updates FileNet P8 date-only properties, need to adjust the timestamp. You need to normalize the timestamp value to 12:00 noon Coordinated Universal Time and exclude the Zulu (Z) token before the date is sent to the client. Normalizing the timestamp ensures that the behavior is predictable and consistent from client to client.
- Some useful methods to normalize the date-only properties are:
- To normalize the date-only properties that are retrieved from the FileNet P8 server before they
are sent to the client:
Call the
DateUtil.getISODateString((Date date, boolean timeZoneAdjust, boolean dateOnlyProp)method to return an ISO date string without the Zulu token (Z). By omitting the Zulu token on the timestamp, the client displays the date as-is, regardless of the time zone. For example,
where property is of type com.filenet.api.property.Property and propDesc is of type com.filenet.api.meta.PropertyDescription.String returnValue = DateUtil.getISODateString(property.getDateTimeValue(), true, P8Util.isDateOnlyProperty(propDesc))// "returnValue=”2021-01-25T12:00:00.000" - To normalize the date-only string value received from the client to 12:00 noon Coordinated
Universal Time before the value is set:Call the
DateUtil.parseISODateForDateOnly(String isoDateString)method to return a Date object with the time component set to 12:00 noon Coordinated Universal Time. For example,Date value = DateUtil.parseISODateForDateOnly(isoDateString);// "isoDateString=”2021-01-25T00:00:00.000-08:00"
- To normalize the date-only properties that are retrieved from the FileNet P8 server before they
are sent to the client: