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

modifyHolidays.set() only works on server side #22

Open
martinshhh opened this issue Mar 29, 2018 · 2 comments
Open

modifyHolidays.set() only works on server side #22

martinshhh opened this issue Mar 29, 2018 · 2 comments

Comments

@martinshhh
Copy link

On client side when I call moment.modifyHolidays.set('Canada') and then log it with moment().holidays() it returns the default locale (us).
This only works server side. Is it possible to get it to work on client side?

@daniel-varela
Copy link

Well, this is weird. I have the exactly opposite issue.
On my machine (running nodeJs version 8.10) I get running moment().modifyHolidays.set('Germany/RP') my desired holidays set. Though it doesn't seem to this on my server (an Azure function to be precise). Even though both are running a node Js server at the same version (8.10).

@daniel-varela
Copy link

The problem is a bug when using moment-holiday on windows.
The failure of the set method occurs internally when calling the getLocale function. On Mac (like my dev laptop) and Linux (like your AWS server) this will not fail. Unfortunately due to the used backslashes in node for windows, this will fail since in this case the __dirname is not split at all.

Unfortunately no error is thrown since there is no catch block to catch an exception.... I'll create a pull request in the next hour in order to fix this.

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

2 participants