0

Working with ap-angular2-fullcalendar package (<-- fullcalendar.io )

Creating a new event at say 6AM - 8AM leads to moment saving it in DB as 4AM - 6AM

I console logged every part of the process:

That's the start select object:

Moment {_isAMomentObject: true, _i: Array(7), _isUTC: true, _pf: {…}, 

_locale: Locale, …}
_a: (7) [2017, 10, 6, 6, 0, 0, 0]
_ambigTime: false
_ambigZone: true
_d: Wed Nov 08 2017 08:00:00 GMT+0200 (שעון רגיל ירושלים) {}
_fullCalendar: true
_i: (7) [2017, 10, 6, 6, 0, 0, 0]
_isAMomentObject: true
_isUTC: true
_isValid: true
_locale: Locale {_fullCalendar_weekCalc: "local"}
_offset: 0
_pf: {empty: false, unusedTokens: Array(0), unusedInput: Array(0), overflow: -1, charsLeftOver: 0, …}
_z: null
__proto__: Object

That's the end select object:

Moment {_isAMomentObject: true, _i: Array(7), _isUTC: true, _pf: {…}, _locale: Locale, …}
_a: (7) [2017, 10, 6, 8, 0, 0, 0]
_ambigTime: false
_ambigZone: true
_d: Wed Nov 08 2017 10:00:00 GMT+0200 (שעון רגיל ירושלים) {}
_fullCalendar: true
_i: (7) [2017, 10, 6, 8, 0, 0, 0]
_isAMomentObject: true
_isUTC: true
_isValid: true
_locale: Locale {_fullCalendar_weekCalc: "local"}
_offset: 0
_pf: {empty: false, unusedTokens: Array(0), unusedInput: Array(0), overflow: -1, charsLeftOver: 0, …}
_z:null
__proto__: Object

From Response:

end: "2017-11-06T06:00:00.000Z"   // <--- 6AM
start: "2017-11-06T04:00:00.000Z" // <--- 4AM

The calendar component renders the event with the data as selected But when I re-render the page - it shows the event with the times saved in DB, which are -2 hours then what I had selected

I read around - "Date parsed with GMT+2" - I understand it is probably something linked to timezones, but could not link it to solving my own problem with this specific exercise

Help please?

shuk
  • 1,745
  • 1
  • 14
  • 25

1 Answers1

1

Dug in https://fullcalendar.io/docs/timezone/timezone/

Fixed by adding

timezone: 'local' to calendarOptions

shuk
  • 1,745
  • 1
  • 14
  • 25