Page 1 of 1

MST/MDT timezones

Posted: Tue Aug 05, 2014 10:28 am
by HaggisMan
Do my eyes deceive me or do I *still* have to manually put the store in/out of daylight savings time? I'm running GOLD build 7345.

Re: MST/MDT timezones

Posted: Tue Aug 05, 2014 3:29 pm
by Katie
Yes because the feature has not been requested, and not all countries and states participate so trying to do any time adjustments automatically may be problematic.

You are welcome to request the feature by clicking the green Feedback button.

Re: MST/MDT timezones

Posted: Wed Aug 06, 2014 6:18 am
by NC Software
Oh yes it has :) Long long ago and many times in other forums. Logan is well aware. The reasoning I "believe" was a .NET framework issue but with .NET 4 and later support it "should" be implemented. I think the AC site is the only one that doesn't have this functionality, even lesser PHP sites have it.

Re: MST/MDT timezones

Posted: Fri Aug 08, 2014 6:20 am
by jguengerich
I put this in my user and admin login page's Page_Init methods:

Code: Select all

            CommerceBuilder.Stores.StoreSettingsManager settings = CommerceBuilder.Common.AbleContext.Current.Store.Settings;
            bool isDaylight = DateTime.Now.IsDaylightSavingTime();
            if (isDaylight && settings.TimeZoneCode != "CDT")
            {
                settings.TimeZoneCode = "CDT";
                settings.TimeZoneOffset = -5.0;
                settings.Save();
            }
            else
            {
                if (!isDaylight && settings.TimeZoneCode != "CST")
                {
                    settings.TimeZoneCode = "CST";
                    settings.TimeZoneOffset = -6.0;
                    settings.Save();
                }
            }
Our site is member only, so this way before anyone does anything, the time will be adjusted if necessary. I'm sure the actual time zone and offset could be extracted from .Net instead of hard-coded. Another way to do it would be to use a timer in Global.asax, like AC does for the Google Feed generation.

Re: MST/MDT timezones

Posted: Fri Aug 08, 2014 6:25 am
by NC Software
It only affects Admin data "viewing" AFAIK so it could be processed on access to /admin

Re: MST/MDT timezones

Posted: Fri Aug 08, 2014 6:34 am
by jguengerich
I think you're right, but I wasn't 100% sure, so I did both just in case.