Git Product home page Git Product logo

moment-holiday's People

Contributors

aarongerig avatar diomed avatar dliberat avatar h3ct0rjs avatar kodie avatar nahuelovejero avatar silentgamelan avatar wonder2991 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

moment-holiday's Issues

broken?

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>```

minification (?) causes error in gulp build process

I'm having an issue when code is compiled and minified via gulp / browserify / babelify / gulp-uglify

Uncaught TypeError: Cannot read property 'united_states' of undefined, at:

p = function(t) { if (regions = t.split("/"), t = regions[0].toLowerCase().replace(" ", "_"), regions.shift(), !s.holidays[t]) try { var r = "./locale/"; "build" == n.split("/").slice(-1).pop() && (r = "." + r), e(r + t) } catch (s) {} return !!s.holidays[t] && (regions.length ? u(t, regions) : s.holidays[t]) }

in moment-holiday-us.min.js

It works fine with the same build process if I tell browserify not to minify via options, which skips gulp-uglify. Any thoughts on what could be going on?

add International Women's Day

In Berlin/Germany the 8th March is an officially legally holiday, please add Locale Germany/Berlin and International Women's Day

isHoliday() doesn't work

import holiday from "moment-holiday";

console.log(
      holiday().holiday('Thanksgiving')._d,
      holiday().holiday('Thanksgiving').isHoliday(),
      holiday().holiday('Thanksgiving').isHoliday('Thanksgiving')
    );

some issue using this in angular

hi,
when I try to use is in angular, it gives me warning:

WARNING in ./node_modules/moment-holiday/build/moment-holiday-us.min.js
10:53-60 Critical dependency: require function is used in a way in which dependencies cannot be statically e
xtracted
WARNING in ./node_modules/moment-holiday/build/moment-holiday-us.min.js
6:3284-3296 Critical dependency: the request of a dependency is an expression

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!

Calculates Day After Thanksgiving incorrectly for 2019

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

TypeError: Cannot read property 'fn' of undefined

I have problem with this error.
I use this library with moment.js and i'm tried to use moment-holiday because i want to check weekend and holiday in my project.so i'm install this libray and import to project and get this error how i fix it

NodeJs: Regions is not defined (in strict_mode)

Hi, I'm getting the following error:

ReferenceError: regions is not defined
    at d (/var/app/current/node_modules/moment-holiday/build/moment-holiday-us.min.js:6:3117)
    at Object.add (/var/app/current/node_modules/moment-holiday/build/moment-holiday-us.min.js:6:5870)
    at Object.<anonymous> (/var/app/current/node_modules/moment-holiday/build/moment-holiday-us.min.js:16:116)
    at Object.<anonymous> (/var/app/current/node_modules/moment-holiday/build/moment-holiday-us.min.js:16:138)
    at Module._compile (module.js:573:30)
    at Object.Module._extensions..js (module.js:584:10)
    at Module.load (module.js:507:32)
    at tryModuleLoad (module.js:470:12)
    at Function.Module._load (module.js:462:3)
    at Module.require (module.js:517:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/var/app/current/bin/src/app/utils/cost/strategies/publicHoliday.strategy.js:5:1)
    at Module._compile (module.js:573:30)
    at Object.Module._extensions..js (module.js:584:10)
    at Module.load (module.js:507:32)
    at tryModuleLoad (module.js:470:12)

Any idea why this is happening?
I'm using NodeJs v8.4.0 on AWS with typescript compiler.

The library is included as follows:

import * as moment from "moment";
import "moment-holiday";

Lacking Webpack integration

The package cannot be imported in a Webpack setup: import moment from 'moment-holiday yields Error: Cannot find module ".". A require calls does not succeed either. Could you add support for Webpack?

P.S. Originally discovered in the context of create-react-app.

modifyHolidays.set() only works on server side

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?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.