For DEVS - Logan... How to Improve Timezone Support

For general questions and discussions specific to the AbleCommerce GOLD ASP.Net shopping cart software.
Post Reply
User avatar
NC Software
AbleCommerce Partner
AbleCommerce Partner
Posts: 4620
Joined: Mon Sep 13, 2004 6:06 pm
Contact:

For DEVS - Logan... How to Improve Timezone Support

Post by NC Software » Thu May 21, 2015 5:32 am

For the AC DEV Team:

As you know and from posts and uservoice submissions I made, the time zone handling in AC has a lot to be desired, i.e. it's lacking and requiring a merchant to change the time zone every time DST changes is just not a great situation. It finally bit me causing my sale (coupon) to not work an hour before sale end time. I have a proposed solution for you.

Background:

Having spent a lot of time in mobile development the past few years as well as working with aviation apps where our users (pilots) travel and deal with timezones frequently, time zones are a royal PITA. .NET's System.TimeZone and later System.TimeZoneInfo are lacking and just cannot keep up with what the world is doing with time zones. Localities are changing their time zones and even the date DST changes such as the most recent Mexico's Cancun/Cozumel areas moving to Eastern from Central and changing DST on some odd date different from North America. Mobile devices use a system called Olson timezones backed by IANA such as everyone now is familiar with timezones such as America\New_York. This is actually a brilliant system and thanks to John Skeet (noted .NET developer) there is a library called NodaTime available through NuGet, source on GitHub that can answer the call for AbleCommerce as I recently implemented in an ASP.NET Web Site project for airline pilots processing their airline trip data. We used to use the old TimeZoneInfo type processing and it just does not cut it.

Suggested Solution:

1) Offer a checkbox in the Merchant Admin in the Store Timezone area "Use Server" - that's what I would use as my servers are aligned to my timezone - done - easy!
2) In addition, use the NodaTime to populate a drop down list of IANA / Olson Timezones by country and locality, i.e. US - America/New_York
3) Once the user picks their locality they never need to touch this again! NodaTime automatically knows the DST data such as changeover dates and the timezone processing is done using the NodaTime library which is very simple to use and has many other capabilities AC can take advantage of as well such as the periods of time, but I digress.
4) Believe it or not timezone changes occur far too often, NodaTime keeps updated as well as you can import the IANA database manually but with each AC update you can update NuGet packages and ship the latest timezone database with your product.

This solves your timezone problem. Estimated level of work: 1 DAY

If you need help, contact me, I'll gladly assist development.

References:
- NodaTime: http://nodatime.org
- IANA: https://www.iana.org/time-zones
- NodaTime BLOG: http://blog.nodatime.org
- Good article on the problems with .NET's implementation: http://blog.nodatime.org/2011/08/what-w ... nyway.html
Neal Culiner
NC Software, Inc.

Post Reply