Problem with Blog DatePicker and Culture Specific Date/Time

This is the place to report bugs and get support. When posting in this forum, please always provide as much detail as possible.

Please do not report problems with a custom build or custom code in this forum. If you are producing your own build from the source code and have problems or questions, ask in the developer forum, do not report it as a bug.

This is the place to report bugs and get support

When posting in this forum, please try to provide as many relevant details as possible. Particularly the following:

  • What operating system were you running when the bug appeared?
  • What database platform is your site using?
  • What version of mojoPortal are you running?
  • What version of .NET do you use?
  • What steps are necessary to reproduce the issue? Compare expected results vs actual results.
Please do not report problems with a custom build or custom code in this forum. If you are producing your own build from the source code and have problems or questions, ask in the developer forum.
This thread is closed to new posts. You must sign in to post in the forums.
6/25/2010 3:31:07 PM
Gravatar
Total Posts 57

Problem with Blog DatePicker and Culture Specific Date/Time

Hi

I would like to report these two problems although it may be my mistakes.

1:In the blog module when you click Datepicker to set start date nothing happens .

2:All dates are in Gregorian calendar disregarding of what culture you are using.It was OK in previous releases.For example if you browse the site with fa-IR culture dates are still in English like 2010/5/4 and not in Persian like 1389/3/2.In some places like blog archive it shows the year correct (1389) but the month incorrect!!

The site for Persian community is working file though.

 

Thanks

6/26/2010 6:36:08 AM
Gravatar
Total Posts 18439

Re: Problem with Blog DatePicker and Culture Specific Date/Time

Hi,

The datepickers don't really support Persian culture or non-gregorian calendars as far as I know.

I think you can get the same behavior as our Persian Community if you add this to your user.config and touch Web.config:

<add key="UseCustomHandlingForPersianCulture" value="true" />

I'm not 100% sure that will solve it as the Persian Community site has not been upgraded in quite a while so there may be other differences.

Best,

Joe

6/26/2010 12:19:58 PM
Gravatar
Total Posts 57

Re: Problem with Blog DatePicker and Culture Specific Date/Time

Hello Joe,

If datepicker does not support specific culture then it should work based on Georgian!

Also adding <add key="UseCustomHandlingForPersianCulture" value="true" /> to the web.config causes "Object reference not set to an instance of an object."  error in CultureHelper.cs line 34:

object obj = typeof(DateTimeFormatInfo).GetField("m_cultureTableRecord",
BindingFlags.Public | BindingFlags.Instance | BindingFlags.NonPublic).GetValue(info);

It was OK in previous releases.

Thanks

6/26/2010 1:01:20 PM
Gravatar
Total Posts 18439

Re: Problem with Blog DatePicker and Culture Specific Date/Time

Actually nothing changed about it, I believe the null reference happens only under .NET 4, it worked previously under .NET 3.5. The only change may be that I made it not use the special handling by default unless you add the config setting I mentioned. I did this to avoid the error under .NET 4.

Maybe you can look in mojoPortal.Web.Framework.CutlureHelper. GetPersianCulture() and figure out a solution for .NET 4. The current code was not implemented by me but by Asad Samarian. I'm not sure what has changed in .NET 4 that may affect it.

Persian Calendar has not been well supported in the .NET framework so very hacky solutions have been used. I'mnot sure if any improvements are available in .NET 4, maybe you could look into it.

If datepicker does not support specific culture then it should work based on Georgian!

I'm not sure everyone would agree about that. A lot of work was done by Asad to make dates display for Persian in the blog a while back but I have left such efforts up to Asad and anyone else who uses Persian culture to find solutions. Asad had me comment out some code not too long ago due to feedback from another Persian language user in the community. So this also could account for diference with the Persian community site which has not been upgraded in a while.

We have a provider model for DatePicker so other date pickers could be plugged in. I think there is a .NET Persian DatePicker on the web (at least there was one last time I looked into it) that is free but is not open source and cannot be included in mojoPortal but it may be possible to implement a provider for it and plug it in to mojoPortal.

Best,

Joe

6/26/2010 1:28:52 PM
Gravatar
Total Posts 57

Re: Problem with Blog DatePicker and Culture Specific Date/Time

Thanks for explanation.I will contact samad.

Thanks again

You must sign in to post in the forums. This thread is closed to new posts.