1.0.0 • Published 3 years ago

moment-hk-business-days v1.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
3 years ago

moment-hk-business-days

A Moment.js plugin based on moment-business-days that integrated with Hong Kong Public Holidays Data.

Installation

npm i moment-hk-business-days

Usage

const moment = require('moment-hk-business-days')();

API

getHolidays(options)

await moment.getHolidays(); 
// ['2020-01-01', '2020-01-25', '2020-01-27', ...]

await moment.getHolidays({withName: true, lang: 'tc', dateFormat: 'DD/MM/YYYY'}); 
// lang options: ['en', 'tc', 'sc']
// [{ date: '01/01/2020', name: '一月一日' }, { date: '25/01/2020', name: '農曆年初一' }, { date: '27/01/2020', name: '農曆年初三' }, ...]

initBusinessDays(options)

await moment.initBusinessDays();
// Configure business days with default settings 

await moment.initBusinessDays({locale: 'us', workingWeekdays: [1, 2, 3, 4, 5, 6]});