1.1.1 • Published 2 years ago

dayjs-financialdate v1.1.1

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

DayJS Financial Plugin

A Day.js plugin to get Financial-related year and quarter from dates.

Initialization

import dayjs from 'dayjs'
import FinancialYearQuarter from 'dayjs-financial'
dayjs.extend(FinancialYearQuarter())

Usage

dayjs("2022-03-08").financialYear();                          // 2021
dayjs("2022-03-08").financialMonth();                         // 12
dayjs("2022-03-08").financialQuarter();                       // 4
dayjs("2022-03-08").startOf("financialYear");                 // dayjs("2021-01-01")
dayjs("2022-03-08").endOf("financialYear");                   // dayjs("2023-03-31")
dayjs("2022-03-08").endOf("financialYear");                   // dayjs("2023-03-31")
dayjs('2022-04-21').isSame('2022-06-30', 'financialYear');    // true
dayjs('2022-12-21').isSame('2023-10-01', 'financialQuarter'); // true

Notes

The FinancialYearQuarter function can take an argument specifying the month at which your financial year start.

dayjs.extend(FinancialYearQuarter())  // Defaults to 4 (April)
dayjs.extend(FinancialYearQuarter(1)) // January
dayjs.extend(FinancialYearQuarter(7)) // July

Contributors

contributers

1.1.1

2 years ago

1.1.0

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago