1.0.12 • Published 2 years ago

@kotonosora-tech/date-utils v1.0.12

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

version MIT License

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'
];
* /

Authors

Nguyễn Duy Thắng

License

MIT

1.0.12-alpha.3

2 years ago

1.0.12-alpha.1

2 years ago

1.0.12-alpha.2

2 years ago

1.0.12

2 years ago

1.0.11

4 years ago

1.0.10

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago