Skip to content
This repository has been archived by the owner on Dec 31, 2020. It is now read-only.

Calculates Day After Thanksgiving incorrectly for 2019 #21

Open
AndrewLane opened this issue Mar 20, 2018 · 6 comments
Open

Calculates Day After Thanksgiving incorrectly for 2019 #21

AndrewLane opened this issue Mar 20, 2018 · 6 comments

Comments

@AndrewLane
Copy link

AndrewLane commented Mar 20, 2018

Looks like the library assumes that the Day After Thanksgiving is the 4th Friday of November based on this code:

date: '11/(5,4)',

However, on years like 2019 when the first day of the month of November is Friday, this means that the code will actually calculate the day after Thanksgiving as being before Thanksgiving itself. To repro:

var momentHoliday = require("moment-holiday")
var moment = require('moment');

var newYears2019 = moment('2019 01 01', 'YYYY MM DD');

console.log(momentHoliday(newYears2019).holiday('Thanksgiving').format('YYYY MM DD'));
console.log(momentHoliday(newYears2019).holiday('Day After Thanksgiving').format('YYYY MM DD'));

Expected:

2019 11 28
2019 11 29

Actual:

2019 11 28
2019 11 22
@huangxuewu
Copy link

same issue

AndrewLane added a commit to AndrewLane/moment-holiday that referenced this issue Oct 5, 2018
* Unfortunately, I did not take the time to figure out a fix
@AndrewLane
Copy link
Author

FYI I added a test that demonstrates the bug here: #34

I hope it's helpful.

@jorgedrr
Copy link

jorgedrr commented Nov 8, 2018

I have the same issue

@smarth55
Copy link

date: '11/(5,[23])' does the job. I added a custom day after thanksgiving with that date, but I can make a PR with the change.

@AndrewLane
Copy link
Author

@smarth55 actually at this point i'm wondering if we should consider this a dead project since I haven't seen commits since 2017.

@joeycozza
Copy link

joeycozza commented Nov 22, 2019

The day of reckoning is upon us!!!

Hopefully no one has important client facing code relying on this! Our little slack bot tool didn't give us our notifications this morning because of this bug, but that doesn't REALLY matter. Good luck all moment-holiday users!

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

No branches or pull requests

5 participants