Handling Time Zone Challenges in Software Testing

Time Zones Are Challenging

Without a doubt, time and time zones is one of the most “painful” and difficult topics for everyone who is involved in software development in one way or another. And we are not even talking about major international projects that may affect various countries and continents. It’s enough to understand that there are 10+ different time zones within the US alone, and if we add daylight savings time.

As tempting as it is, I won’t take the comedic approach to summing up what every developer must face with this issue. This has been done many times over and over (as an example, I will recommend the following video).

A QA Point of View on Time Zone Testing

The role of QA with the complex issue is definitely not do is advise which libraries to use, or how we will convert time or not. In my opinion, QA’s approach should be the same with any complex topic–maximum awareness on the topic and specific practical ways to avoid or solve it.

For example, with time zones, a tester should really understand what they are, how the transition to summer / winter time works (daylight saving time, in the US), basics like how many seconds are in a minute, and so on. Armed with this knowledge, the probability is closer to 100% that we will be able to offer and develop more competent check options. If, when reading the previous sentence, you had a question: “Who would not know how many seconds are in a minute?”, then this blog is perfect for you!

To get started, I would like to build a further analysis of the topic as follows. First, I’ll outline some basic terms and concepts of time and time zones. Next, I’ll cover the most commonly unknown facts or misconceptions about time zones. Finally, I’ll offer you my practical recommendations on how to best test on a software project with time zone considerations.

The Basics

At the heart of time zones is the concept of UTC. UTC stands for Coordinated Universal Time (with the words ordered the other way in French). Despite the common misconception, UTC is not itself a time zone. UTC, is the primary time standard by which the world regulates clocks and time. It is kind of a “ground zero” for all other time to be measured against.

Since time is different in different parts of the world, it is usually described as UTC plus or minus a certain offset. But, it’s important at this step not to confuse offset with time zone. For example: UTC-7:00, UTC+3:00, etc do not represent time zones. They instead represent the UTC offset — at a given moment of a particular region’s time. A time zone is defined as a geographic area with a specific offsets during different parts of the year.

Also many time zones observe daylight saving time, so a time zone’s offset can change depending on the time of the year. Daylight saving time (DST) is the practice of advancing clocks (typically by one hour) during warmer months so that darkness falls at a later hour, then putting it back for winter. The typical implementation of DST is to set clocks forward by one hour in either the late winter or spring and to set clocks back by one hour in the autumn to return to standard time.

Now when we have a basic understanding of main concepts about time and time zones we could discover the most interesting and surprising misconceptions about time. 

Common Misconceptions About Time Zones

Time Zone Offsets Are Not Always Full Hours

Image 1.

Time Zone Offsets Are Not Always Full Minutes

Image 2.

Time Zones Are Not Always Between -12 and +12

Image 3.

Midnight Is Not Possible On All Dates

Image 4.

DST Is Not Always +1 or -1 Full Hour

Image 5.

Not All Time Zones Observe DST

Image 6.

GMT and UTC Are Not The Same

Image 7.

Leap Years Don’t Always Happen Every 4 Years

Image 8.

Some Calendars Have Leap Months

Image 9.

A Year is Not Always 365 or 366 Days

Image 10.

Recommended Testing Process for Time Zones

The following matrix shows the most common test cases I use to try to test all of the unexpected things about time and time zones outlined above: 

Image 11. Test-cases for TZ testing

Additional test cases could be useful if we have to test, for example, an ongoing event which takes place in the transition between DST. My last advice would be to test a couple of time zones that use half-hour offsets. This Matrix plus these additional test-cases will cover a solid percent of the test-cases related to time and time zones.

My only remaining recommendation is how actually change time on your computers for these tests. Previously, a common way to do it was to change your computer’s current time zone in the settings, but for testing web application, I now recommend simply use the Chrome developer instrument for that. It’s more accurate, convenient and reduces the possibility that the browser will circumvent your local change your time locally, and still figure out your actual time zone. 

3 dots menu in dev console —> more tools —> sensors 

From here, simply set up your location in a different time zone, and go straight to your testing.

Summary

Time zones are difficult, and there a lot of hidden details that can make testing time-zone-aware code tricky. Educating yourself on the intricacies of time zones can help you to test for all the edge cases better, and coming up with a list of those cases, as I have suggested, will help you ensure you’ve tested them all carefully every time.

Thanks for reading. I hope you found it helpful!

Related Blog Posts

We hope you’ve found this to be helpful and are walking away with some new, useful insights. If you want to learn more, here are a couple of related articles that others also usually find to be interesting:

Our Gear Is Packed and We're Excited to Explore With You

Ready to come with us? 

Together, we can map your company’s software journey and start down the right trails. If you’re set to take the first step, simply fill out our contact form. We’ll be in touch quickly – and you’ll have a partner who is ready to help your company take the next step on its software journey. 

We can’t wait to hear from you! 

Main Contact

This field is for validation purposes and should be left unchanged.

Together, we can map your company’s tech journey and start down the trails. If you’re set to take the first step, simply fill out the form below. We’ll be in touch – and you’ll have a partner who cares about you and your company. 

We can’t wait to hear from you! 

Montage Portal

Montage Furniture Services provides furniture protection plans and claims processing services to a wide selection of furniture retailers and consumers.

Project Background

Montage was looking to build a new web portal for both Retailers and Consumers, which would integrate with Dynamics CRM and other legacy systems. The portal needed to be multi tenant and support branding and configuration for different Retailers. Trailhead architected the new Montage Platform, including the Portal and all of it’s back end integrations, did the UI/UX and then delivered the new system, along with enhancements to DevOps and processes.

Logistics

We’ve logged countless miles exploring the tech world. In doing so, we gained the experience that enables us to deliver your unique software and systems architecture needs. Our team of seasoned tech vets can provide you with:

Custom App and Software Development

We collaborate with you throughout the entire process because your customized tech should fit your needs, not just those of other clients.

Cloud and Mobile Applications

The modern world demands versatile technology, and this is exactly what your mobile and cloud-based apps will give you.

User Experience and Interface (UX/UI) Design

We want your end users to have optimal experiences with tech that is highly intuitive and responsive.

DevOps

This combination of Agile software development and IT operations provides you with high-quality software at reduced cost, time, and risk.

Trailhead stepped into a challenging project – building our new web architecture and redeveloping our portals at the same time the business was migrating from a legacy system to our new CRM solution. They were able to not only significantly improve our web development architecture but our development and deployment processes as well as the functionality and performance of our portals. The feedback from customers has been overwhelmingly positive. Trailhead has proven themselves to be a valuable partner.

– BOB DOERKSEN, Vice President of Technology Services
at Montage Furniture Services

Technologies Used

When you hit the trails, it is essential to bring appropriate gear. The same holds true for your digital technology needs. That’s why Trailhead builds custom solutions on trusted platforms like .NET, Angular, React, and Xamarin.

Expertise

We partner with businesses who need intuitive custom software, responsive mobile applications, and advanced cloud technologies. And our extensive experience in the tech field allows us to help you map out the right path for all your digital technology needs.

  • Project Management
  • Architecture
  • Web App Development
  • Cloud Development
  • DevOps
  • Process Improvements
  • Legacy System Integration
  • UI Design
  • Manual QA
  • Back end/API/Database development

We partner with businesses who need intuitive custom software, responsive mobile applications, and advanced cloud technologies. And our extensive experience in the tech field allows us to help you map out the right path for all your digital technology needs.

Our Gear Is Packed and We're Excited to Explore with You

Ready to come with us? 

Together, we can map your company’s tech journey and start down the trails. If you’re set to take the first step, simply fill out the contact form. We’ll be in touch – and you’ll have a partner who cares about you and your company. 

We can’t wait to hear from you! 

Thank you for reaching out.

You’ll be getting an email from our team shortly. If you need immediate assistance, please call (616) 371-1037.