dayjs-financialdate
TypeScript icon, indicating that this package has built-in type declarations

1.1.1 • Public • Published

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

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.1.1
    2
    • latest

Version History

Package Sidebar

Install

npm i dayjs-financialdate

Weekly Downloads

11

Version

1.1.1

License

MIT

Unpacked Size

40 kB

Total Files

13

Last publish

Collaborators

  • ankhllc