#1 2017-02-28 14:33:35

Antonio.Cambule
Member
Registered: 2017-02-19
Posts: 38

Can Date Input Value be shown formatted?

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

Offline

#2 2017-02-28 15:00:36

David
Admin
From: Alcobendas, Madrid, Spain
Registered: 2015-04-21
Posts: 1,660
Website

Re: Can Date Input Value be shown formatted?

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.

Online

#3 2017-02-28 15:25:38

Antonio.Cambule
Member
Registered: 2017-02-19
Posts: 38

Re: Can Date Input Value be shown formatted?

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?

Offline

#4 2017-02-28 15:31:52

David
Admin
From: Alcobendas, Madrid, Spain
Registered: 2015-04-21
Posts: 1,660
Website

Re: Can Date Input Value be shown formatted?

Hello Antonio,

Antonio.Cambule wrote:

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.

Online

Board footer

Powered by FluxBB


Copyright ©2018 DecSoft. All rights reserved.