Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: n.addValue is not a function in production build #10

Open
bluescreen opened this issue Aug 6, 2020 · 0 comments
Open

TypeError: n.addValue is not a function in production build #10

bluescreen opened this issue Aug 6, 2020 · 0 comments

Comments

@bluescreen
Copy link

When compiling in prod setting i get the following error. In dev mode its working.

TypeError: n.addValue is not a function
    at e.tagHolidayDefinition (country.js:60)
    at abstract-holiday-definition-factory.js:157
    at Array.map (<anonymous>)
    at t.e.getDefinitionsForAdministrativeUnits (abstract-holiday-definition-factory.js:157)
    at t.e.loadDefinitions (abstract-holiday-definition-factory.js:217)
    at t.loadDefinitionsCached (index.js:55)
    at t.e.getDefinitions (abstract-holiday-definition-factory.js:227)
    at t.getHolidayDefinitions (sync-moment-holiday.js:34)
    at t.for (sync-moment-holiday.js:51)
    at t.isHoliday (sync-moment-holiday.js:39)

Here is my code

import moment from "moment";
import createMomentHolidayConfiguration from "@nesto-software/moment-holiday";
const holidays = createMomentHolidayConfiguration("DE", "NW");

function calcWorkDays(start, end){
    let workDays = 0;
    do{
        start.add(1, 'day');
        if([0,6].indexOf(start.day()) == -1 && !start.isHoliday(holidays)){
            workDays++;
        }
    }while(start.isBefore(end))
    return workDays;
}

const start = moment("2011-03-01", "yyyy-mm-dd");
const now   = moment();
const workDays = calcWorkDays(start,now);
console.log(workDays);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant