@date-vir/duration
Version:
Durations units an utils for date-vir.
88 lines (87 loc) • 2.53 kB
TypeScript
import { type Subtract } from 'type-fest';
import { type LocaleOptions } from '../locale.js';
/**
* Names of all months in English. Don't use this for strings shown to the user, instead use
* {@link getMonthNames}.
*
* @category Unit
*/
export declare enum MonthName {
January = "january",
February = "february",
March = "march",
April = "april",
May = "may",
June = "june",
July = "july",
August = "august",
September = "september",
October = "october",
November = "november",
December = "december"
}
/**
* All English month names in order.
*
* @category Unit
*/
export declare const orderedMonthNames: readonly [MonthName.January, MonthName.February, MonthName.March, MonthName.April, MonthName.May, MonthName.June, MonthName.July, MonthName.August, MonthName.September, MonthName.October, MonthName.November, MonthName.December];
/**
* A type for all valid month numbers. (1-12)
*
* @category Unit
*/
export type MonthNumber = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;
/**
* A type for all valid month indexes. (0-11)
*
* @category Unit
*/
export type MonthIndex = Subtract<MonthNumber, 1>;
/**
* Bounds for valid month numbers.
*
* @category Internal
*/
export declare const monthNumberBounds: {
readonly min: 1;
readonly max: 12;
};
/**
* A type for all valid days in a month. (1-31)
*
* @category Unit
*/
export type DayOfMonth = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31;
/**
* Bounds for valid day of the month numbers.
*
* @category Internal
*/
export declare const dayOfMonthBounds: {
readonly min: 1;
readonly max: 31;
};
/**
* Gets all month names in various formats with the given locale. Defaults to the current user's
* locale.
*
* @category Language
*/
export declare function getMonthNames(options?: Readonly<LocaleOptions>): {
long: {
numbered: Record<MonthNumber, string>;
keyed: Record<MonthName, string>;
indexed: Record<0 | 5 | 3 | 8 | 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11, string>;
};
short: {
numbered: Record<MonthNumber, string>;
keyed: Record<MonthName, string>;
indexed: Record<0 | 5 | 3 | 8 | 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11, string>;
};
narrow: {
numbered: Record<MonthNumber, string>;
keyed: Record<MonthName, string>;
indexed: Record<0 | 5 | 3 | 8 | 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11, string>;
};
};