Open capaneus opened 6 years ago
Did you find a solution for this? I am having the same problem.
See this PR:
https://github.com/kodie/moment-holiday/pull/31
You can use my fork like this:
"moment-holiday": "https://github.com/lwensveen/moment-holiday.git#require",
Hi there, we at @nesto-software are currently open sourcing a new moment-holiday library which further improves this great approach by kodie. There is only a small number of supported countries yet. However if you want to check it out: https://github.com/nesto-software/moment-holiday/
For the frontend, there is an usage example.
Not super pretty, but this works in an angular cli project as such:
1) add the following to the scripts array of your angular-cli.json file:
"./node_modules/moment/min/moment.min.js",
"./node_modules/moment-holiday/build/moment-holiday-us.min.js"
2) In the file where you want to import moment-holiday, instead just add declare var moment: any;
at the top of that file. Don't import moment or moment-holiday. Then use this library as normal: moment().holidaysBetween(<some_moment_object>)
EDIT: The reason why this is not too too bad, is that npmjs.com has runkit integration and you can test your code there: https://npm.runkit.com/moment-holiday
get it running, and just transfer the code to your main project
Still an issue - any update on this would be much appreciated.
hi, when I try to use is in angular, it gives me warning:
and when it's loaded in browser:
Uncaught TypeError: Cannot read property 'fn' of undefined
I'm new to js and typescript, so couldn't figure out a way to fix it. so if anyone could take a look would be awesome.
what I did in code is to test some functions:
import * as holidays from 'moment-holiday';
this.locales = holidays.load('united_kingdome');
Thanks!