How to change date format for Admin interface?

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
5 лет назад
Hi,  

sorry been meaning to post this for the last 2 weeks.  Weve been in and completed all the updates for 4.0 proving all will be good moving forward with dynamic regional preferences.

How to

1.  ensure your on 4.0
2.  ensure your language culture is correct in config->languages & config->stores->default lang
3.  As the NOP guys have been saying its all about the "culture" beign selected.  So just be aware, weve not tested this with the russian (and i think European) , & . issues

nop-4.0-admin-culture-fix.zip
nop-4.0-admin-culture-fix-patch.diff

Drop in the attached ZIP overriding your files OR checkout the patch.diff showing all thats changed.

PS We removed bootstrap-touchspin because it has culture issues and used jQuery UI spinner instead
https://jqueryui.com/spinner/#decimal


As ever a quick Caveat : Our system we made these changes on is not a raw 4.0, so DO NOT do this directly onto any live server.  That being said i think it should just be a drag and drop.
5 лет назад
networkfusion wrote:
in src/Presentation/Nop.Web/Administration/Views/Shared/_AdminLayout.cshtml add:

Html.AppendScriptParts("~/Scripts/kendo/2014.1.318/cultures/kendo.culture.en-GB.min.js");


(obviously change the locale to the one you need)

under

Html.AppendScriptParts("~/Scripts/kendo/2014.1.318/kendo.web.min.js");


then add:

<script type="text/javascript">
        //set kendos current culture to the "en-GB" culture script
        kendo.culture("en-GB");
</script>


(make sure the locale is the same as the one you have used above) to just before </head> tag.


in src/Libraries/Nop.Core/CommonHelper.cs

change the locale in SetTelerikCulture() to the one you want set (the same locale as used above)


Looks like this worked for me, I haven't ran into any issues yet but will update if I do. I am using nopCommerce v3.90
5 лет назад
Can we get an admin setting to specify the culture? We have US date format on our invoices which confused a customer recently. I'd rather avoid changing the nop source code as I know next time I update I will lose the changes or forget to update them.
5 лет назад
a.m. wrote:
Go to your language detail page (admin area) and set its language culture property to any culture that supports "dd/mm/yyyy" (e.g. ru-RU)


I have two stores...one for United States and one for Canada.  They are both English speaking countries but have different cultures...do I need to duplicate the all the languages to achieve different cultures?  What is the best way to handle this
5 лет назад
looks like NOP are already working for a fix for culture changes (hopefully to be released in 4.2).
What version of NOP are you using and what is your issue?

if 4.0/4.1 and you want to change date formats in admin from mm-dd-yyyy,  the above fix we posted will change ths in admin and you could pick yyyy-mm-dd so that all date popups allows you to enter/select/view dates in the same format.
does that make sense?

Simon.
4 года назад
simon@ibridge wrote:
looks like NOP are already working for a fix for culture changes (hopefully to be released in 4.2).
Simon.


I guess this is still not fixed in 4.2?
3 года назад
Hello,
The problem, 3.80 in the global.asax
the use SSL made.
webHelper.GetThisPageUrl(false)= "http "
webHelper.GetStoreLocation()="https"
if (webHelper.GetThisPageUrl(false).StartsWith(string.Format("{0}admin", webHelper.GetStoreLocation()),
  public static Regex rxAdminPage = new Regex(@"://[^/]+/admin(?:$|/.*)", RegexOptions.Compiled);

  if (rxAdminPage.Match(webHelper.GetThisPageUrl(false)).Success)
3 года назад
ignore - just seen other post https://www.nopcommerce.com/en/boards/topic/81874/43-admin-date-format
3 года назад
hi
I use nop 4.30
I think the best solution for this topic, is set default culture format
How I can set default culture format??
I tried for set that in Startup.cs but its not work
can u help me?
ty
3 года назад
I found the solution:

u can change culture format in "Nop.Web.Framework\Globalization\CultureMiddleware.cs".

my code:

after this line:
             var culture = CultureInfo(workContext.WorkingLanguage.LanguageCulture);

u can set format like following lines: (and this formats will use in all of project)

            culture.DateTimeFormat.ShortDatePattern = "yyyy/MM/dd";
            culture.DateTimeFormat.LongDatePattern = "yyyy/MM/dd";
            culture.DateTimeFormat.ShortTimePattern = "hh:mm:ss tt";
            culture.DateTimeFormat.LongTimePattern = "hh:mm:ss tt";
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.