commenthol / date-holidays-parser

parser for worldwide holidays
ISC License
46 stars 22 forks source link

Problem with date in different timezone (UTC Offset) #13

Closed wellgrisa closed 4 years ago

wellgrisa commented 4 years ago

Hello,

We have a timezone system based in different customers within the same codebase. Each customer has its timezone set against itself and we use it together with moment-timezone to deal with their correct and exact time and days (start of, end of and exactly time for each time).

The issue happens when the holiday and the timezone offsets the zulu time per one day, e.g.:

In other words, given:

const hd = new Holidays('AU');
const holiday = hd.isHoliday(new Date("2017-12-31T13:00:00.000Z"));

holiday should be

{ 
  date: '2018-01-01 00:00:00',
  start: 2017-12-31T13:00:00.000Z,
  end: 2018-01-01T13:00:00.000Z,
  name: "New Year's Day",
  type: 'public' 
}

However it's returning that this is not a holiday.

commenthol commented 4 years ago

Problem is verified and fix is on its way. Thanks for rising this issue.

commenthol commented 4 years ago

@wellgrisa Version 1.4.2 is published which should fix the issue.