Skip to content
This repository has been archived by the owner on May 28, 2019. It is now read-only.

Usage - Why am I unable to use a string date formatted in ISO? #120

Open
cleon26 opened this issue Mar 24, 2015 · 5 comments
Open

Usage - Why am I unable to use a string date formatted in ISO? #120

cleon26 opened this issue Mar 24, 2015 · 5 comments

Comments

@cleon26
Copy link

cleon26 commented Mar 24, 2015

My dates are coming back from the server as strings formatted like this:
"2014-08-20T00:00:00-04:00"

What is the trick for making this work with the date picker? I've tried several variations of ui-date-format without success. I get different errors about being unable to parse the string.

@yemaw
Copy link

yemaw commented Apr 5, 2015

Yes, I've the same issue. I've tried many formats and options and still doesn't work.

@yemaw
Copy link

yemaw commented Apr 5, 2015

Hi @cleon26 ,
I think we've got the answer. Formatting the date is in ui-date directive, not in ui-date-format.
Like this,
ui-date="{dateFormat:'yy-mm-dd',changeYear: true, changeMonth: true, yearRange: '1950:-0'}"

@ivan-zakharchuk
Copy link

same problem in one old project

@alexanderchan
Copy link
Contributor

I believe it parses these if there is no date format, however it's safest to use a Date in the model. So new Date("2014-08-20T00:00:00-04:00") will work to parse your iso date.

@ivan-zakharchuk
Copy link

the problem is that even example

<input ui-date ui-date-format="DD, d MM, yy" ng-model="myDate">

where directive ui-date-format doesn't work, but maybe it is only on angular v1.5, because I didn't test this with previous versions

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants