You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 26, 2019. It is now read-only.
I am currently trying to edit a form and since my object is a moment.js object instead of a Date object, it's not binding to the control.
My setup:
I am currently in EDT (UTC-4).
I have a project model, with startDate and endDate – I am saving this as just a date.
With a naive implementation (Ember Data's date transform), when a date is selected, the date is then saved to the backend API without any issues. But when the date is retrieved from the API, since the time is missing from the date, it is converted to my local time, which is a day before.
While this fixed my issue with displaying dates as UTC, and I can save new bootstrap-datepicker values correctly, when I try to edit, since my date is a momentjs object, bootstrap-datepicker doesn't bind to it properly. If I convert it back to a date, datepicker binds correctly but with the wrong date (since it's UTC-4)
What's the shared community solution for this? Surely everyone deals with this?
The text was updated successfully, but these errors were encountered:
I am currently trying to edit a form and since my object is a moment.js object instead of a Date object, it's not binding to the control.
My setup:
I am currently in EDT (UTC-4).
I have a project model, with
startDate
andendDate
– I am saving this as just a date.With a naive implementation (Ember Data's date transform), when a date is selected, the date is then saved to the backend API without any issues. But when the date is retrieved from the API, since the time is missing from the date, it is converted to my local time, which is a day before.
To fix this, I implemented the ember data UTC transform as outlined by Tom Dale in http://blog.skylight.io/bringing-sanity-to-javascript-utc-dates-with-moment-js-and-ember-data/. This converts my date object to a momentjs object and correctly handles UTC.
While this fixed my issue with displaying dates as UTC, and I can save new bootstrap-datepicker values correctly, when I try to edit, since my date is a
momentjs
object, bootstrap-datepicker doesn't bind to it properly. If I convert it back to a date, datepicker binds correctly but with the wrong date (since it's UTC-4)What's the shared community solution for this? Surely everyone deals with this?
The text was updated successfully, but these errors were encountered: