Unable to select the current date from date time picker in perspective irrespective of setting the max date as today's date. It allows to select today's date but when selected set -1 date for the value
Welcome to the forum.
now()function seems to be working in the binding preview but I can only see
8-1 7:45:22in the maxDate binding. Is the year in there as well?
- I don’t see the
props.value. Where are you seeing it?
- There is an error message on the PROPS bar. Hover over the ‘1’ and it will give you some details.
- Your question title should be a summary about the question. The details should be in the body of the post.
now()will update continuously. Every minute would probably be enough so you could use
What version are you using?
maxDate bound to?
value bound to?
Why are you binding the
value of the input? Doing so with a “polling” binding like the
now() expression will eventually overwrite anything a user would select, ie: after a user makes their selection, the expression will re-evaluate and replace their selection with a new value.
If you hover over the warning, what does it tell you?
Version - 8.1.14
maxDate is bound to expression : now() as shown in snapshot
I’m binding the value of input to view param for the value, as I’m using a rendered view for datetime component to be used in table component.
Attaching the warning image.
If you have the value bound to a view parameter then how will the user be able to change the date?
Do you want to load the view with a particular date and then allow the user to select a different one? If that date is today then it’s easy - just use
now(0) which wll run once on loading the view.
Okay, so the problem you’re encountering here is pretty clearly described by the warning message: the
value prop is expecting either
null, a number (unix timestamp) or a date object - but the view param you’ve bound against contains a string (or an empty string).
But the larger problem is that you should never bind the “value” of an input component when that component will be used by an end-user because of the nature of bindings; you never know when they will evaluate and replace the user’s value. For example, if you bind against a View param, and then the user selects a date, and then the page is refreshed for any reason, then the selected value will be the View param instead of the value selected by the user.
Even if I use the date time picker component separately, without binding the value the date I select from the picker for the first time is taken a -1 date. But it takes the same date as selected for the second time. Can you please explain why does this happen so?
In addition to this, if I bind maxDate to now() I cannot select today’s date also. Be it first time or second time, it always takes -1 date.
I don’t know what “-1 date” is. Could you explain what that means in this context?
I suspect you’r trying to convey that you can only select up to the current day - 1 day. This is most likely because of the hour that is selected when you select a day.
Suppose I use the
now() expression for my
maxDate prop and the current time (ON THE GATEWAY) is
2022-8-2 11:23:06. I then attempt to select August 2nd 2022 in the DateTime Picker (or input), but this fails. If you remove the binding for
maxDate and reset it to
null, and then try to select the same date again, you’ll see that the selected date has a value of
2022-8-2 12:00:00. Well, that
12:00:00 value is greater than
11:23:06, so it won’t let you select it.