Input date format in Angular 1.3

162 views
Skip to first unread message

Juan Luis Paz

unread,
Aug 19, 2014, 6:19:07 PM8/19/14
to ang...@googlegroups.com

Hello,


I'm trying to use the input date control with angular 1.3, but I have a problem, the format is yyyy-MM-dd in all navigator without native support of this kind of element, that is different of the behavior that I fond in Chrome, where the date format is dd/MM/yyyy (in Spanish) or in the different mobile platforms happen the same; I really need use the localized version of the date, but in the currently implementation I don't found a way for do it.


Any suggestion? (different from not using input date)


Thanks!

Eric Eslinger

unread,
Aug 19, 2014, 6:32:25 PM8/19/14
to ang...@googlegroups.com
Localized datepicking is definitely pretty annoying. I know you're looking for suggestions within the "use input date" space, but you might want to check out some datepicker addons. I've used 


and


e


--
You received this message because you are subscribed to the Google Groups "AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to angular+u...@googlegroups.com.
To post to this group, send email to ang...@googlegroups.com.
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Sander Elias

unread,
Aug 20, 2014, 1:21:08 AM8/20/14
to ang...@googlegroups.com
Hi Juan,

Did you try setting the $locale to 'es_es' in angular? And did you include the right i18n script?
My guess is you didn't find this page in the documentation ;)

Regards
Sander

Meruem Pitou

unread,
Aug 20, 2014, 11:12:44 AM8/20/14
to ang...@googlegroups.com
Chrome <input type="date" /> requires yyyy-MM-dd which is the HTML5 spec

Juan Luis Paz

unread,
Aug 20, 2014, 12:21:42 PM8/20/14
to ang...@googlegroups.com
That is not true, I attached a screenshot of the input date on chrome.

Imágenes integradas 1

I'm using chrome 36.0.1985.143 on Mac OS X 10.9.4 in Spanish.

The format of the date requested for the user is dd/MM/yyyy


2014-08-20 17:12 GMT+02:00 Meruem Pitou <tlawr...@gmail.com>:
Chrome <input type="date" /> requires yyyy-MM-dd which is the HTML5 spec

--
You received this message because you are subscribed to a topic in the Google Groups "AngularJS" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/angular/HbZKvDEOCG0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to angular+u...@googlegroups.com.

To post to this group, send email to ang...@googlegroups.com.
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.



--
Juan Luis Paz

Travis Lawrie

unread,
Aug 20, 2014, 1:12:29 PM8/20/14
to ang...@googlegroups.com
I think chrome is converting it for you, so the display is different than the backend value

Juan Luis Paz

unread,
Aug 20, 2014, 1:58:57 PM8/20/14
to ang...@googlegroups.com
That's true,

I need to show and handle the date in the localized version when the user interact with the control. The current backend implementation in angular 1.3 is well for me.

The behavior that I expect when the user interacts with the control is:
1.- The date must be showing in the localized format. In Spanish is dd/MM/yyyy. Example: for January 3, 1985 the user must see 03/01/1985
2.- The user must have the possibility to change the date using the localized format. Example: If the user wants to change the date to August 20, 2014, the user must write 20/08/2014
3.- In the backend angular must work as do actually, the problem here is the interaction with the user, not how is represented the data by the backend.


I need a way for interact with the user showing the date in the localized format, one possibility is Angular do it for me handling the i18n in the component, or in the other way, angular should allow me change the default implementation of the parse and format functions by my own implemented version; but in the current implementation in Angular 1.3 I can't do nothing of this, only exists a recommendation of put a placeholder that say the format must be yyyy-MM-dd, that is not a option for me, I can't change the way of the user write the dates.

Thanks!
Reply all
Reply to author
Forward
0 new messages