I have a Custom doctype which manages a custom schedule and i have a calendar for it , when i set the start and end time it sets according to my time zone but when saving it shows the time +3(my timezone difference) and in the calendar it shows the time 3 hours back i.e gmt time of the time i set .
Time Zone in the system settings is proper and in my time zone
I am using datetime and strptime in the backend to calculate , does it have any barring on this issue?
the start time i set , end time is calculated with back end code but sets properly .
But on save this happens:
This +03 is added to my start and end time which i set. (my timezone is +3 gmt)
And on calendar it shows start time as 3 hours back
8:24 instead of 11:24 .
Heres the code i use to calculate end time .
temp = datetime.strptime(starts_on, “%Y-%m-%d %H:%M:%S”)
end =temp + timedelta(minutes = it.duration)
Where start_on takes the start date time and it.duration is some integer value of minutes by which start time is added .
Can anyone help me on this?
Thanks in advance.
Any body got any intput for this , this is a real concern .
Are you sure your timezone in System Settings is the same as your timezone, i.e +3 gmt?
Because I tried the same, the calendar time is as per the timezone in System Settings.
Yes , the timezone in system settings is same as my time zone and the calendar in the events are working as expected with proper time.
But for some reason this issue is coming in my custom calendar,
That is the reason i posted it under developer and not labeled as Bug.
Maybe someone in the community has some experience with this, – is it something i coded ?
i am using date time with -
from datetime import datetime, timedelta, date
Than changing the start time with strptime as above and adding minutes to it .
is there a standard format which ERPNext date expects ?
if so how can i change it back to standard ERPNext format after adding the minutes?
any help is appreciated .
Any suggestions ?
still unable to figure out why is it setting as +03 ,
i even commented the adding of minutes and enter start and end dates manually ,but still it becomes +03 as soon as i save.
How is it handled in Events where there is no problem …is there anything extra i need to add , i cant spot it ,
any help is appreciated…
I solved it ,
the trick was to save the dates using
It seems the general datetime does not take into consideration local time set in Erpnext .
studied the code on Events.py and tried this way and it worked. now both calendar and document times are in sync as local.