How to manipulate date type without using calendar UI

How do I create or edit a date element given a day, month and year as integers i.e. not using the visual calendar element (which doesn’t work well for a number of use cases).

The functionality (and documentation) around date manipulations seems incomplete - at least this critical part doesn’t make complete grammatical/logical sense to me:


… change date to …
Modifies the date and replaces the date of the month.


I assume ‘date of the month’ means ‘day of the month’, but even so how do I access the ‘month’ as well as the ‘day’?

Other aspects of the date type (minutes/hours/years) seem accounted for - and well documented - though I imagine someone else might one day also need to update the missing ‘seconds’.

Have you tried the date picker? Or just the calendar element?

Yes, I addressed this specifically in my query.

Why not using the input element with date as type of content?

Using input field eases a lot of the pain. However I still face a few problems:

  1. The ‘year’ in the input field is restricted to the range 1900-2099 whereas the type of content I’m handling requires manipulating historical and future dates e.g. 1850 or 2100, even ignoring some more complex scenarios.

  2. I can’t update the ‘month’ on a date type i.e. the option ‘change month to…’ is curiously missing from the set of related functions

  3. I’d like to customise the UI around the date input, for example, to independently update the day, the month, the year, or any combination of these given a particular date. I could create a workaround by wrapping/masking a date input field with something else, but without (2) above this is not possible as I wouldn’t have access to the ‘month’

  4. In a date-type input field, the predefined field ‘initial content’ doesn’t display the defined value. For example, current date/time (today) displays 21.01.yyyy (using date_2 format).

I could bypass all these issues if I had access to a ‘change month to’ action on a date. That way I can manipulate any date however I wish.

Thanks.

@emmanuel @georgeciobanu i’m still not able to move beyond the issues I raised here - please help.

I’m also now certain there’s a bug where existing dates loaded onto a date-type input field don’t display properly (i.e issue 4).

At the very least it would be especially useful to enable the ‘change month to’ function on a date type as I could then bypass all the issues with a custom UI for date manipulations.

I’ll follow this up with an email support request in case that gets better attention.

We added the change month option, should be live today.

2 Likes

great - this is very helpful, thanks.

for public benefit, if anyone wants to update dates dynamically, there’s now a complete set of actions to get/set any part of a date (at least the core parts - day/month/year).

1 Like

I’m having the same problem displaying the date:

We are using DatePicker 2… any ideas why the year is not showing??