Welcome to the forum.
- Your
now()
function seems to be working in the binding preview but I can only see8-1 7:45:22
in the maxDate binding. Is the year in there as well? - I donât see the
-1
inprops.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.
Tips:
- 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 usenow(60000)
.
What version are you using?
What is maxDate
bound to?
What is 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.