2
Who ever used the type="date"
HTML5 certainly noted that although the date is visible in the DD/MM/YYYY, when you retrieve the value by Javascript, it is in the format YYYY-MM-DD.
What I want is just to reproduce that same effect. The user sees the information in X format, writes in X format, but is actually in Y format.
Would anyone know how to do that kind of masking (if it is possible)? Or at least where I can find some material relevant to my doubt?
I’m searching other forums and on lord Google, but all I find are the usual formatting of how to move from one format to the other.
I know you have the "what to do if you’re ready" class, but my proposal is to learn. I liked the effect created and, if it is possible to reproduce it, I would like to know how.
-- EDIT --
The effect I’m trying to create is this one:
What I do in my case is: I get the date in javascript format YYYY-MM-DD and convert to DD/MM/YYYY. That’s what you want to do?
– CesarMiguel
@Cesarmiguel No. What I want is to reproduce the same effect created by
type="date"
HTML5. For the user the date will be in the format DD/MM/YYYY but for the code it will be in the format YYYY-MM-DD.– Júlio Pradera
You want it visually to be YYYY/MM/DD ?
– user6026
@Fulvius No. Visually will be in format DD/MM/YYYY, but the code will be in format YYYY-MM-DD.
– Júlio Pradera
Sorry I didn’t understand your doubt
– user6026
@Júliopradera, don’t forget that the attribute
date
only works on Chrome. However, I was wrong to reply, what I am doing in javascript is to receive in the formatDD/MM/YYYY
and convert toYYYY-MM-DD
and send to the controller– CesarMiguel
@I put an image to illustrate my doubt.
– Júlio Pradera