Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

KotonoSora/date-utils

Open more actions menu

Date Utils

A small tool calculator calendar in month

version MIT License


Table of Contents

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);
Example:

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[]
Example:

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

About

A small tool calculator calendar in month

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Sponsor this project

Packages

 
 
 

Contributors

Morty Proxy This is a proxified and sanitized view of the page, visit original site.