Skip to main content


 

Symptoms


Suppose you are trying to compare values of datatypes Date and DateTime. You may notice that today's date (e.g. selected in Calendar control with Date Type set to Date or picker type set to Date) will be less than Current Date Time. This can be addressed by adjusting data type/picker types being used or with use of expression.
 

Diagnoses


This is known issue which is related with the fact that Date data type was changed to a date only type that does not have a time whereas the DateTime type is a date with a time. If, for example, calendar control has a datatype of Date the comparison will work for today’s date. But when the calendar control has datatype of DateTime the comparison may fail since the underlying value is a UTC DateTime which is zeroed to the local time 00:00 if no time is selected or if the value is “today”. The UTC date part may not be equal to the Date without time since it’s the UTC value not the local value.
If it is necessary to work with a timezone invariant Date with no Time you should switch the SmartObject property type to Date type to avoid aforementioned issues.
 

Resolution

To address this issue it is necessary do comparison between either Date calendar control and Current Date or DateTime calendar control and Current Date and Time.
Expression can be also used to perform DataType conversion. In case you using rule of "an advanced condition" type to perform your comparison you are unable to use expression directly in this rule. For this case it is possible to leverage text box on a form with expression to perform required conversion (e.g. converttodatetime( ocurrentdate])) and use expression result when performing comparison in advanced condition.




 
Be the first to reply!

Reply