commenthol / date-holidays-parser

parser for worldwide holidays
ISC License
46 stars 22 forks source link

How to make the lib more lightweight ? #50

Closed maximeSurmontGH closed 1 year ago

maximeSurmontGH commented 1 year ago

I need to reduce the lib size (1.1MB) and I would like to know if there is a way to make it more lightweight ?

Capture d’écran 2022-09-22 à 10 18 02

From this issue, I tried using date-holiday-parser (instead of date-holiday) with a custom json data but it made any improvement (still 1.1MB).

// date.utils.ts
import Holidays from 'date-holidays-parser';

const customHolidayJsonData = {
    holidays: {
        FR: {
            names: {
                fr: 'France',
                en: 'France',
            },
            dayoff: 'sunday',
            zones: ['Europe/Paris'],
            langs: ['fr'],
            days: {
                '01-01': {
                    _name: '01-01',
                },
            },
        },
    },
    names: {
        '01-01': {
            name: {
                en: "New Year's Day",
                fr: 'Nouvel An',
            },
        },
    },
};

const holiday = new Holidays(customHolidayJsonData);
holiday.init('FR');

Is there a way of improvement / am I doing something wrong ?