Shopify / javascript-utilities

A set of utilities for JavaScript and TypeScript projects at Shopify.
MIT License
45 stars 9 forks source link

Add new date helper function 'isTomorrow' #53

Closed toyelowo closed 4 years ago

toyelowo commented 4 years ago

Added isTomorrow helper function for future humanize 'today' dates. Also, I noticed that the tests failed, locally even when I switched to master. After debugging, I figured out it was because 2020 was a leap year. Hence, I updated the tests to work properly with leap year.

In addition, I added isLeapYear helper function to identify if a year is a leap year.

Question should how should the TimeUnit handle leap years?

https://github.com/Shopify/javascript-utilities/blob/80890c67d8052b5a1c2656921780a74b0ed72042/src/dates.ts#L32

toyelowo commented 4 years ago

Some old tests fail, I suspect it's because this year is a leap year.