Reputation: 53
In Movilizer i am unable to select current date in calendar screen. actually i want to select current date as well with future dates. Here i restricted past dates, but current date(today's date) also restricted. Less than or equal is not working here. what is the problem here?
<question backNavigationAllowed="true" type="8" title="Select Date" key="PlanningCalendar">
<answer attributeType="72" key="PlannedDate" nextQuestionKey="Comments" dummyAnswer="false">
<text>OK</text>
</answer>
<validation type="ERROR" position="0">
<condition>datetotimestamp(getAnswerValueNew($answer:'PlannedDate')) ?le systemTime()</condition>
<text>You cannot select dates in the past!</text>
</validation>
please help me
Thanks
Upvotes: 0
Views: 60
Reputation: 1724
The problem with this code is the conversion to timestamp.
systemtime gets the current date AND time, for example 1583397144 for today at 9:32 (more or less).
But the answer that you get from the calendar is only date, and Movilizer client understand the hours as zero value. Today value is 1583366400.
So, 1583366400 is lower than 1583397144 and the restriction is working fine.
What should yo do?
One solution is capture the current time, convert to a date variable and reconvert to timestamp. In that way, if you choose same day as today should be evaluate as equal timestamp
Upvotes: 0