Skip to content

date-fns like functions for working with fiscal years.

Notifications You must be signed in to change notification settings

Ed-ITSolutions/fiscal-fns

Repository files navigation

Fiscal-fns

Build Status Coverage Status

Fiscal-fns is a date-fns like package that provides functions for working with fiscal years.

Install

npm install --save fiscal-fns

Usage

Options

All functions take an options object which looks like this:

{
  startMonth: 3, // The month your fiscal year starts in. Be aware this is 0-indexed so 0 = january 11 = decemeber.
  startDay: 1 // The date in the month your year starts on.
}

endOfFiscalYear

Parameter Default Description
date - The date to test, can be either a string or a Date. It is passed to date-fns internally so anything date-fns can parse can be used here.
options {startDay: 1, startMonth: 3} See Options above.

fiscalYear

Parameter Default Description
year - The year to return the start/end of. 2018 will return 1st April 2018 for the start and 31st March 2019 for the end.
options {startDay: 1, startMonth: 3} See Options above.

inFiscalYear

Parameter Default Description
date - The date to test, can be either a string or a Date. It is passed to date-fns internally so anything date-fns can parse can be used here.
startDate - The start of the fiscal year to test.
options {startDay: 1, startMonth: 3} See Options above.

startOfFiscalYear

Parameter Default Description
date - The date to test, can be either a string or a Date. It is passed to date-fns internally so anything date-fns can parse can be used here.
options {startDay: 1, startMonth: 3} See Options above.

About

date-fns like functions for working with fiscal years.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published