search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

When setting timezone to australia/sydney event in day calendar shows 30 mins late

Asked by gothicshres
3 years ago.

i use moment js to arrange time
my calendar config:
$scope.calendarConfig = {
startDate: moment().utcOffset(11).format('YYYY-MM-DD') }
in my database there is different field for time and date so i use this:
moment.unix(unixTime).utcOffset(11).format('YYYY-MM-DD') +'T'+moment.unix(unixTime).utcOffset(11).format('HH:mm:ss'); // this create time format similar to that of
new DayPilot.Date(date) ;

what happens is if i remove utcOffset(11) from above date conversion . it works fine but when i define timezone like that
everything in a event calendar shows 30 mins late that is : if there's a event at 1:30 pm then event is shown at calendar in 2pm cell column.

Comment posted by Dan Letecky [DayPilot]
3 years ago.

Have you checked the actual strings that are produced by the date formatting code?

DayPilot doesn't make any adjustments to the date, it just displays what it receives.

Comment posted by gothicshres
3 years ago.

yeah i checked, this
var date=moment.unix(value.appointment_date).format('YYYY-MM-DD')+'T'+moment.unix(value.appointment_time).format('HH:mm:ss');

and this new DayPilot.Date(date) both produces this date string :
2016-11-29T08:15:00 which i assume is a correct string?

Comment posted by Dan Letecky [DayPilot]
3 years ago.

Can you please give it a try with plain strings to see if it makes any difference? I would also check the startDate value (especially if it doesn't include the time part by accident). The latest DayPilot Lite release automatically strips off the time part but if you are using an older version it might have an effect.

You can also check the runtime values in the console:

// start date
dp.startDate
// events
dp.events.list

That should list the parsed values.

Comment posted by gothicshres
3 years ago.

I tried by keeping plain strings too it doesnt work. But i found a workAround:
previously , i did this :
var date=moment.unix(value.appointment_date).utcOffset(11).format('YYYY-MM-DD') +'T' + moment.unix(value.appointment_time).utcOffset(11).format('HH:mm:ss');
var date2=moment.unix(value.appointment_date).utcOffset(11).format('YYYY-MM-DD') + 'T' + moment.unix(value.appointment_time).add('m',30).utcOffset(11).format('HH:mm:ss'); // i did this 2 make event only 30 m
then it shows 30 mins late.
but when i do this:
var date=moment.unix(value.appointment_date).utcOffset(11).format('YYYY-MM-DD')+'T'+ moment.unix(value.appointment_time).add('m',-1).utcOffset(11).format('HH:mm:ss'); //here substracting -1 to -30 works
var date2=moment.unix(value.appointment_date).utcOffset(11).format('YYYY-MM-DD')+'T'+ moment.unix(value.appointment_time).utcOffset(11).format('HH:mm:ss');

// this works but i don't understand why? Any explanation? is my method to show event for 30 mins (date2) wrong ? (making events.start and events.end 30 mins difference wrong?)

Comment posted by Dan Letecky [DayPilot]
3 years ago.

Can you please try to modify the following fiddle so that it reproduces the issue?

https://jsfiddle.net/urg6639x/1/

This question is more than 3 months old and has been closed. Please create a new question if you have anything to add.