Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change date format #32

Closed
geoidesic opened this issue Apr 1, 2014 · 5 comments
Closed

change date format #32

geoidesic opened this issue Apr 1, 2014 · 5 comments

Comments

@geoidesic
Copy link

The output from this seems to be ISO (i.e. YYYY-MM-DD"T"HH:MM:SS"0Z")
Is there any way to alter the output format?

Odd thing is that it shows the correct format in the field, but when the data from the model that the field updates is submitted via $http the date's format is ISO.

@CosticaPuntaru
Copy link

it returns a date, angular or javascript formats it to the iso... you can simply do something like
<div date-range start="model.startTime" end="model.endTime"></div>
and then show the dates like:
flight between {{model.startTime.toDateString() }} and {{model.startTime.toDateString() }}

@geoidesic
Copy link
Author

Thanks.. that really helped! What I'm still confused about is how to change the way the date displays as it get's placed by the datepicker in the datepicker field. For an input field using toDateString on the value attribute doesn't seem to work reliably.

<input type="text" template="datepicker.html" date-time ng-model="start.value" required="true" view="hours" partial="true" value="{{start.value.toDateString()}}">

That seems to work if you click a date, but once you click a time then it goes back to YYYY-MM-DD H:M format.

@g00fy-
Copy link
Owner

g00fy- commented May 14, 2014

@geoidesic
use format="angular-format-string"

@geoidesic
Copy link
Author

The trouble with an angular format string is that it's not automatically localised, whereas toDateString() is.

@g00fy-
Copy link
Owner

g00fy- commented May 14, 2014

@geoidesic
It is, just need to use angular-i18n and include the script with the language you want. See https://github.com/angular/bower-angular-i18n and https://docs.angularjs.org/guide/i18n

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

No branches or pull requests

3 participants