Hi all,
I’m using a date time input component to try to generate metrics/reports over a period of days, weeks, and months. This component is malfunctioning in all sorts of ways. Are there known issues with this component?
-
Binding to the props.value doesn’t give me the correct time
1a. Start Date Exp Binding:
addHours(getDate( getYear(now(0)) , getMonth(now(0)) , getDayOfMonth(now(0))), 3)
1b. End Date Binding:
addSeconds(addMinutes(addHours(getDate( getYear(now(0)) , getMonth(now(0)) , getDayOfMonth(now(0))), 23), 59), 59)
-
Days are sometimes off on the initial binding (hence why I am adding 3 hours to the start date expression, it think it is the previous day before 3 am?) and don’t always appear correctly in the Date box after it is populated. For example, I am trying to bind 23:59:59, but it shows up as 8:59 PM in the date input box. I suspect this has to do with preventing the user from selecting a time, and only selecting a date. But we should be able to force the time to be whatever we want without selection.
-
Sometimes, it doesn’t appear as a date, it yields 2019-10-29T04:00:00:000Z as a date which breaks everything (it should be a date, but is not considered one). I can’t seem to catch this when it does happen. I suspect it is expression binding related…but it works half the time and fails the other half.
Image below.
Best,
Roger
By any chance is your gateway in the different timezone than your designer/session? The expressions that are used for the binding are going to be gateway scoped and any session that connects to it will show the “value” of the date localized to the session’s timezone. This would explain point 1 and 2.
Point 3, is a little strange. The format you see is what you would normally see if the date was turned into a string. Are you by any chance also doing any transforms/bindings/change scripts to labels that may be turning the date into a string?
Hi,
Yes, the gateway is in EDT and I am in MST so there is a 3 hour difference there. That makes sense then.
There is an expression transform that does this:
Property Binding:
value = /root/Filters/StartDateContainer/DateTimeInput.props.value
Expression Transform:
getDate(getYear({value}) , getMonth({value}) , getDayOfMonth({value}))
However, this should return another date object. Nothing is indicative of creating a string here.
This one I have no idea about.
I have a binding on the label that is doing this:
try(dateFormat({view.params.startDate}, "MM/dd/yyyy") + " - " + dateFormat({view.params.endDate}, "MM/dd/yyyy"), {view.params.startDate} + " " + {view.params.endDate})
In the event that it cannot format the startDate, it will return a string. So it looks like somewhere before this it is becoming a string. After changing the start and end date at least once, the problem is fixed.
Best,
Roger