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

broken? #24

Open
rlayne opened this issue Mar 31, 2018 · 2 comments
Open

broken? #24

rlayne opened this issue Mar 31, 2018 · 2 comments

Comments

@rlayne
Copy link

rlayne commented Mar 31, 2018

I can't get any indication this plugin works with the latest or previous versions of moment.js. (I tried specifically using moment.js 2.0.0 as well as latest as of today).

Minimal case is:

<script src="js/moment.js"></script>
<script src="js/moment-holiday.js"></script>

<script>
var currentTime = moment();
console.log(currentTime); //Correct time shown

console.log('YOU: ' + currentTime.format("HH:mm DD-MM-YYYY")); //Correct time shown

var holiday = moment().isHoliday(null, true); //moment(...).isHoliday is not a function
</script>```
@daniel-varela
Copy link

As stated in the documentation:

If you're not using Node (or anything that doesn't support the require function), you'll need to make sure that you include the locale file(s) that you're trying to use.

<script src="./moment-holiday/locale/canada.js"></script>
<script src="./moment-holiday/locale/easter.js"></script>
<script>
  moment.modifyHolidays.set('Canada').add('Easter');
  moment('2001-12-26').isHoliday('Boxing Day');
  //true
</script>

@rlayne
Copy link
Author

rlayne commented Apr 5, 2018

Oh, I'm sorry. I thought the minimal example provided under "browsers" would be sufficient. I should have read the entire document just in case something like that was randomly put in later.

Adding the additional locale file(s) doesn't change the outcome whatsoever.

<script src="js/moment.js"></script>
<script src="js/moment-holiday.js"></script>
<script src="js/united_kingdom.js"></script>
<script>
var currentTime = moment();
console.log(currentTime); //Correct time shown

console.log('YOU: ' + currentTime.format("HH:mm DD-MM-YYYY")); //Correct time shown

var holiday = moment().isHoliday(null, true); //moment(...).isHoliday is not a function
</script>```

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