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

Passing date to datePicker's model doesn't respect format #3033

Closed
germanger opened this issue Nov 29, 2014 · 5 comments
Closed

Passing date to datePicker's model doesn't respect format #3033

germanger opened this issue Nov 29, 2014 · 5 comments

Comments

@germanger
Copy link

This is my view

<input type="text" class="form-control" ng-readonly="true" datepicker-options="datePickerOptions" datepicker-popup="yyyy-MM-dd" ng-model="myDate" is-open="datePickerIsOpen" current-text="Hoy" clear-text="Clean" close-text="Cerrar" />

This is my controller:

$scope.myDate = new Date();

$scope.datePickerOptions = {
    formatYear:'yyyy',
    startingDay: 1,
    showWeeks:'false'
};

$scope.datePickerIsOpen = false;

And the result is that the date is displayed as this:

 Sat Nov 29 2014 16:32:12 GMT-0300 (Pacific SA Daylight Time)

Instead of "2014-11-29"

When I re-select the date (not programatically but with clicks) it turns to the correct format.

I was using 0.11.2 and didn't had this issue. I updated with bower and now I'm using 0.12.0 and I now have the issue described.

@hendricius
Copy link

Having the same issue with 0.12.0 as well.

This pull request fixes it: https://github.com/angular-ui/bootstrap/pull/2943/files

@marmuel
Copy link

marmuel commented Dec 4, 2014

I also have this issue 0.12.0.

@germanger
Copy link
Author

Any workaround?

@gzoritchak
Copy link

This issue is probably duplicated. This workaround worked fine for me:

#2659 (comment)

@chrisirhc
Copy link
Contributor

Indeed, closing as duplicate of #2659.

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

No branches or pull requests

5 participants