Can Date Input Value be shown formatted?


Antonio Cambule

Hi there,

I would like to show the DateValue inside of the Date Input formatted like this:

DD.MM.YYYY

I've seen several posts how to bring date values formatted into a text input or how to manipulate it
to show in other control, but is it also possible to show it formatted directly in the date input?

thanks and regards
Antonio


DecSoft

Hello Antonio,

Unfortunatelly there is not possible to set the format of the HTML5 input date control. You can take a look at this StackOverflow thread, for example. Certainly the browsers must to shown the format according to the user preferences, but apparently not all the browsers do it in the same way.

On the other hand, this input type is intended because the browsers (and other platforms like in the Android's WebView) allows to choose a date using certain calendar dialog. Maybe you can use a "normal" Text input to give the user's input, or provide three Inputs/Select controls for the day, month and years.



Antonio Cambule

Is it possible then, to use a text input (to show the value formatted) and open up the native date selection (lets say on click),
or do i have then to fully customize my own date selection?


DecSoft

Hello Antonio,

Is it possible then, to use a text input (to show the value formatted) and open up the native date selection (lets say on click),
or do i have then to fully customize my own date selection?

Certainly I try it before... by assign the Date Input to certain Label control. However, they apparently doesn't work with the Date Input hidden (curiously this same approach works with an Input File control).

In my opinion, if we don't want to rely in the Date Input, the best we can do is to prepare three controls for the year, month and day. These controls can be in a separate view which can be shown as a dialog. And, additionally, this controls can be Select controls instead of Number Inputs, then the user only must to choose one of the possible values. If you do not it before, take a look at the "DateTime" sample Antonio.


Everybody can read the DecSoft support forum for learning purposes, however only DecSoft customers can post new threads. Purchase one or more licenses of some DecSoft products in order to give this and other benefits.

This website uses some useful cookies to store your preferences.

I agree. Hide this note. Give me more information.