I have a date/time picker which is giving me the "Undefined Invalid Date" message when a date is presented from the database or chosen with the date picker which was in 2021 rather than 2022.
Do I have something wrong in the way I am using the Date Picker?
Or is this a bug of some kind?
Here is the code for the date picker... note that I am not displaying the year in the format="" area...
<input id="i_mt_autosend_time" class="ml-2 b_right2 rc_5 c_right7 fs_80 w_200" name="autosend_time_display"
is="dmx-date-picker" timepicker="" minutes-increment="60"
dmx-bind:value="message_template.data.message_template.autosend_time.addSeconds(-server_offset_seconds.value)"
format="ddd D MMMM (h:mm a)" utc="true" placeholder="Select date and time:"
dmx-show="(i_mt_autosend.checked) && (message_template.data.message_template.associated_with=='i') && (message_template.data.message_template.audience=='a')">
Antony, there is no year added in your date format. How does the calendar know which year have you selected to mark the correct date or allow selection? That’s why it breaks. You need to add year to your date format.
I had assumed that it would internally store the complete date (including year) as selected, but then allow me to display a subset of that date (so in this case without the year).
Well of course, how would it know which year is selected when you pass to it a date like 21 Dec?
Which is the year selected? Or should it mark all the 21 Dec as active/selected?
Well I had assumed that internally the date/time picker would know which year you had selected, and you could then choose which parts of that to display.
No date picker works in this way Antony. The year must always be included for them to display/operate correctly, it is integral to their functionality. How you then display the date after it is inserted in to the database, using formatters, is completely different. You can do what you like in that regard.