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

Datepicker should convert String (or Number) to Date #628

Closed
dipold opened this issue Jul 5, 2013 · 1 comment
Closed

Datepicker should convert String (or Number) to Date #628

dipold opened this issue Jul 5, 2013 · 1 comment

Comments

@dipold
Copy link

dipold commented Jul 5, 2013

The problem:

When loading an entity with angular's $http/$resource, angular creates the model by using native JSON function and all dates/datetimes are converted to String or Number.
The Datepicker wait for a ng-Model value must be a Date object - currently it get a error!

Workaround:
Convert the String (or Number) to Date in the Datapicker directive.
There are in angularjs a jsonStringToDate function in date $filter that makes this job

@pkozlowski-opensource
Copy link
Member

@dipold We've started down the "automatically covert strings to Dates" route in the https://github.com/angular-ui/ui-date and it was a disaster. There are simply way too many formats that would could automatically handle. The proper solution is to use formatters / parsers (or a custom directive that would take care of conversions).

Going to close this one as we are just discussing plugging into the ngModel machinery in #612. Let's move the discussion there.

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

2 participants