"Undefined Invalid Date" Message in Date/Time Picker For Dates in 2021...!

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.

28 Jun 1

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"
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')">

Here is the value being bound…

28 Jun 4

28 Jun 3

28 Jun 2

Hi Antony, looks like you have your date format wrong. You have days in there twice and no year?

@Teodor, could you take a look at this issue for me please? Many thanks! :pray:

I think Antony is displaying his date like ‘Mon 21 December’ @brad, so not sure that is the issue.

@Teodor, do you think I am using the date picker incorrectly here or that this is a bug of some kind?

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).

Yes, adding the year to the format fixed it.

So basically @Teodor, we are saying that the date picker doesn’t work unless the year is displayed in the format string…

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.

But no worries if it doesn’t work that way!

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.