change datepicker for Persian calender

Topics: Localization
Oct 26, 2012 at 11:57 AM
Edited Oct 29, 2012 at 6:23 PM

Hi, i want to change orchard date to Persian date.

I change datepicker for it and this correctly worked.

Now i want to change  orchard's now date to datepicker date.

Please help me for it.


Coordinator
Oct 26, 2012 at 8:23 PM

What do you mean?

Oct 27, 2012 at 12:35 PM
Edited Oct 29, 2012 at 12:28 AM

for exmaple in Orchard\Modules\Orchard.PublishLater\Drivers\PublishLaterPartDriver.cs

// the date time is entered locally for the configured timezone
 var timeZone = Services.WorkContext.CurrentTimeZone;

this code entered locally date(Gregorian Calendar), i want to use datepicker date instead it for save now date. Can i use PersianCalendar for it?

http://msdn.microsoft.com/en-us/library/system.globalization.persiancalendar.aspx
Help me please.

Coordinator
Oct 29, 2012 at 8:00 PM

Probably not without fixing the code for it. I don't think that code knows how to handle non-Gregorian calendars as it is.

Oct 30, 2012 at 11:16 PM

Thanks for your answer.

I think Orchard for current date use from windows current date, I want to change it to PersianCalendar for current date.

for example

when i change datepicker to our culture (fa-IR) and publish a content by publish later, Orchard displays "You cannot schedule a publishing date in the past" error,

Because our current year is 1391.

I setup Orchard in http://www.donyayesharg-ind.com for test it. please visit this to view my problem.

username: admin

pass: adminadmin

Thanks.

Coordinator
Oct 30, 2012 at 11:32 PM

Looking at Orchard's code, it converting the entered date to Utc and comparing to UtcNow. So your 1391 year will be 1391 in Utc too and it will fail.

I need better understanding of the differences between calendars and their implementation in .NET, but I would assume that's a missing feature in Orchard to not only define the Timezone but also the calendar to use. You can create a new work item and point to this discussion.