This is a migrated thread and some comments may be shown as answers.

calendarengines.js and persian calendar

2 Answers 163 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Ali
Top achievements
Rank 1
Ali asked on 15 Aug 2013, 07:43 AM
Hi dear telerik team
I bought your source code and hardly tried to change the code of CalendarEngines.js file to change the Gregorian calendar to Jalali(Persian) calendar but I failed because I can't understand some of your variable in this code(like num1,num2 and etc in GetDatePart function). So if you have a JavaScript code for Persian calendar can I ask you to send it for me. I really need it.
with great thanks.

2 Answers, 1 is accepted

Sort by
0
Vasil
Telerik team
answered on 16 Aug 2013, 08:09 AM
Hello Ali,

These variables and the code inside the GetDatePart is used to calculate the proper year, day and month from ticks, taking into account the Leap Years:
http://en.wikipedia.org/wiki/Leap_year

So for example the num1 will give you the days since it is: ticks / this.TicksPerDay.
Then num2 will be used to keep how many of 400 years there are, to calculate further how many are the leap years, and co on. If you will rewrite the code, you don't actually need to keep this private variables.

GetDatePartDay is actually the reverse of the GetAbsoluteDate function. See the GetAbsoluteDate function, it is a bit more easier to understand. If the Persian calendar has different calculation of the leap years, you will need to rewrite both GetAbsoluteDate and GetDatePartDay functions.

On a side note, you said you bought the controls, but I don't see any license linked on your account, if you have any problems with your account and/or sending support tickets, you could contact to our sales department to figure out what is happened.

Regards,
Vasil
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
0
Ali
Top achievements
Rank 1
answered on 19 Aug 2013, 05:53 AM
I solved my problem and now I have a PersianRadCalendar.
with a great thanks to telerik team
Tags
Calendar
Asked by
Ali
Top achievements
Rank 1
Answers by
Vasil
Telerik team
Ali
Top achievements
Rank 1
Share this question
or