Page 1 of 1

[ANGULAR] Wrong DateTime when open Event Editor

Posted: Wed Jun 02, 2021 6:06 am
by SHQK

I'm using change() for listeners everytime "endTimeField" in Event Editor change,

            endTimeField: {
                listeners: {
                    change({ value, source }) {
                        console.log("endTimeField:", value)
                    }
                }
            }

But the time is correct but the date always wrong
For example, I chose today in Calendar, but the Date always Jan/01/2020
How can I fix this issue?


Re: [ANGULAR] Wrong DateTime when open Event Editor

Posted: Wed Jun 02, 2021 2:55 pm
by saki

These are two separate date objects: one for date part with ignored time and one for time part with ignored date. So the correct endDate is the combination of both. The correct date is calculated when you click Save.

What do you need it for? Maybe we can suggest another approach.


Re: [ANGULAR] Wrong DateTime when open Event Editor

Posted: Wed Jun 02, 2021 4:18 pm
by SHQK
saki wrote: Wed Jun 02, 2021 2:55 pm

These are two separate date objects: one for date part with ignored time and one for time part with ignored date. So the correct endDate is the combination of both. The correct date is calculated when you click Save.

What do you need it for? Maybe we can suggest another approach.

Ya, the Date is correct when I click Save, but the Time is wrong.
I changed the endTime but it's always 1 hour from startTime

        calendar.onBeforeEventSave = ({ eventRecord }) => {
            console.log("Datetime when click save: ", eventRecord.data.endDate)
        };

Re: [ANGULAR] Wrong DateTime when open Event Editor

Posted: Thu Jun 03, 2021 4:37 am
by SHQK
saki wrote: Wed Jun 02, 2021 2:55 pm

These are two separate date objects: one for date part with ignored time and one for time part with ignored date. So the correct endDate is the combination of both. The correct date is calculated when you click Save.

What do you need it for? Maybe we can suggest another approach.

I need the correct DateTime ( both Date and Time ) when I change the Time to set it to my model to update later


Re: [ANGULAR] Wrong DateTime when open Event Editor

Posted: Thu Jun 03, 2021 10:39 am
by saki

data is not a public property of the model. Use please function https://bryntum.com/docs/calendar/#Scheduler/model/EventModel#function-get, but post back please if it does not resolve the issue.

Check also also values in https://bryntum.com/docs/calendar/#Scheduler/view/Scheduler#event-beforeEventSave - this property contains new values.