@kotonosora-tech/date-utils
v1.0.12
Published
A small tool calculator calendar in month
Downloads
6
Maintainers
Readme
Installation
npm install @kotonosora-tech/date-utils --save
# or with yarn
yarn add @kotonosora-tech/date-utils
Features
Get Key Month
Return from date, to date available of month by select day, month start date, action change start date and holidays in a round year
getKeyMonthFromToDate(param);
import { getKeyMonthFromToDate, DateKeyFormat, MonthlyStartDateAction } from '@kotonosora-tech/date-utils';
const holidays: string[] = [
'2020-01-01',
'2020-04-30',
'2020-05-01',
'2020-09-02',
]
const result = getKeyMonthFromToDate(
new Date(),
1,
MonthlyStartDateAction.NoChange,
holidays
);
/**
{
keyMonth: '2022-07-01-2022-07-31',
fromDate: '2022-07-01',
toDate: '2022-07-31'
}
* /
Get Page Month
Return list string format
YYYY-MM-DD
of page calendar by first day of week, from and to date
getPageMonth(param: IPageMonth): string[]
import {getPageMonth, FIRST_DAY_OF_WEEK} from "@kotonosora-tech/date-utils";
let result: string[] = getPageMonth(
FIRST_DAY_OF_WEEK.MONDAY,
new Date(2020, 6, 10),
new Date(2020, 7, 5)
);
/**
result = [
'2020-06-08',
'2020-06-09',
...
'2020-07-11',
'2020-07-12'
];
* /