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

Partial moment support breaks defaultValue #37

Closed
wjzijderveld opened this issue Oct 22, 2013 · 2 comments
Closed

Partial moment support breaks defaultValue #37

wjzijderveld opened this issue Oct 22, 2013 · 2 comments

Comments

@wjzijderveld
Copy link

Just ran into a bug caused by the partial Moment support. Setting a (default) value doesn't work anymore.

https://github.com/Eonasdan/bootstrap-datetimepicker/blob/master/src/js/bootstrap-datetimepicker.js#L216

On that line it asumes this._date is a Date object, while it actually is a Moment object. Causing the getUTCFullYear to fail.

Sadly I don't have enough mocha/coffeescript knowledge (and not enough time to learn) to write a test for it.

Edit: forgot to mention (although maybe obvious), this bug occurs when Moment IS available.

@wjzijderveld
Copy link
Author

For others facing this issue: a workaround for now, is to use setValue with a timestamp
$element.datetimepicker('setValue', timestamp), that way we trick datetimepicker to create a Date object itself (see: Line 213)

@Eonasdan
Copy link
Owner

version 2 is completely based on moment. thanks for the work around

stanhu added a commit to stanhu/bootstrap-datetimepicker that referenced this issue Jul 18, 2014
Repository owner locked and limited conversation to collaborators Jun 17, 2017
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