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

the calendar is marking 1 day before returned from the database #30

Open
ekuhnen opened this issue Apr 12, 2016 · 1 comment
Open

the calendar is marking 1 day before returned from the database #30

ekuhnen opened this issue Apr 12, 2016 · 1 comment

Comments

@ekuhnen
Copy link

ekuhnen commented Apr 12, 2016

When the calendar plugin tries to read the dates there are in the $scope.events, the calendar displays a day before (if in the $scope.events have de date 12/04, the calendar displays the event on 11/04). Apparently, the calendar is reading the date in a wrong way, because when I click in the day with a event and print de date parameter that cames in the dateClick function, it shows that have GMT -3 (Tue Apr 12 2016 21:00:00 GMT-0300 (Local Standard Time)) and I dunno from where it cames. How I take off this GMT and from where I should take it off?

@jasonandress
Copy link

The solution is simple - pass the entire date/moment in the event.date field, for example
Tue Sep 13 2016 00:00:00 GMT-0400 (Eastern Daylight Time)

When you give a date in the format as suggested "2016-09-13" the existing code treats it as UTC and then converts it to your local timezone. So for eastern which is -4, it would treat this as 2016-09-12 20:00:00. This is what is marking it 1 day before the date in the event array.

I originally just added one day to the date, a suggestion in a previous comment. This caused a problem for my users in timezones before UTC, like Germany. Then I put a hack in that checked their timezone and only added 1 day if the utcOffSet < 0. This started not working for certain android version, handsets.

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

2 participants