DK dates is a libary wrapper around DayJS that includes helper functions for commonly used date formats and calculations.
> npm install @diamondkinetics/dk-dates
import { dkdates, DateType, DateFormat, DateSegment } from '@diamondkinetics/dk-dates';
dkdates.getDayJS();
dkdates.isAfter(date1, date2);
dkdates.getFormattedDate(DateFormat.YEAR, date)
...
...
export type DateType = Dayjs | Date | string | number;
export enum DateFormat {
YEAR = 'YYYY',
MONTH_FULL = 'MMMM',
MONTH_ABB = 'MMM',
MONTH_NUM = 'MM',
FULL_SLASH = 'M/D/YYYY',
FULL_DASH = 'MM-DD-YYYY',
YEAR_REV = 'YYYY-MM-DD',
ORDINAL = 'Do',
MONTH_ORD = 'MMMM Do',
}
export enum DateSegment {
YEAR = 'year',
MONTH = 'month',
DAY = 'day',
}
All code changes should be made in dates.ts
. And of course add tests in dates.spec.ts
> npm run tests
A new release is created when we merge to main.
The semantic-release
library will handle versioning, tagging and release back to GitHub and to NPM.