Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Holidays are only recognized at 00:00 #11

Closed
schwarmco opened this issue Feb 12, 2020 · 1 comment
Closed

Holidays are only recognized at 00:00 #11

schwarmco opened this issue Feb 12, 2020 · 1 comment

Comments

@schwarmco
Copy link

schwarmco commented Feb 12, 2020

A holiday should be recognized on the whole day.
The example snippet const nowIsHoliday = moment().isHoliday() in the README suggests, that this is also meant to be in the feature scope.

Example Code:

const moment = require('moment-feiertage')

console.log(moment('2020-12-25 17:00').isHoliday()) // false
console.log(moment('2020-12-25 00:00').isHoliday()) // 1. Weihnachtsfeiertag

A possible fix would probably be, to change

if (_moment.isSame(holidays[h].date)) {

to

if (_moment.isSame(holidays[h].date, 'day')) { 
@DaniSchenk
Copy link
Owner

Damn! That's critical. Thank you for reporting back. I provided a fix and updated tests. Missed that in my Typescript rewrite...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants