persion calendar

Hi Does DayViewer support Persian calendar?

Hello,

Unoftunately, there is no easy way to implement Persian calendar in dhtmlxScheduler, it requires quite an extensive work with the source codes.
You can start by looking into the default date methods of the scheduler:


You can redefine some or all of them from your code.

I think we implemented Persian calendar as a part of a separate project some time ago (it wasn’t included in the official build of the scheduler). The working approach was to implement a class which has all methods of JS Date but works in Persian calendar and to replace all ‘new Date’ calls in scheduler codebase with a factory method e.g. ‘createDate(params)’ that could return either a native JS Date or a custom Persian Date object depending on configuration. Once is switched to another Date implementation, scheduler worked pretty much as expected and it could be switched between different calendars in a runtime.

Moth labels could be changed using locales.

Unfortunately, I don’t have more specific instructions, nor can I provide a code we implemented for that project.

Hello
Thanks for the explanation
Another question
Can I increase or decrease the number of days in a month?
For example, should I change a month that is 28 days to 31 days?

Hi @Sara_Yousefi

Did you try this way?

I.e. Scheduler uses a native JS Date where you can’t change the number of days in the month. You should create a custom Date object for the Persian calendar instead and specify there the required number of days.

Hello
I was able to solve this problem to some extent for the time being, but it is still not a complete and correct method.
Another problem I have is the start of the week, is it possible to start the week on Saturday?
Thanks for your support

Hi @Sara_Yousefi

There is start_on_monday config to set week start either from Monday or from Sunday.

To specify any another day, you should redefine it in the scheduler.date.week_start function in the source code:

A small description in the article “Custom View” also can be helpful:
https://docs.dhtmlx.com/scheduler/custom_views.html#stepbystepexample

Regards

hi
fixed
thank you so much