Properties
Private
#date
#date: Dayjs
Accessors
ISO
- get ISO(): string
-
Returns string
RFC3339
- get RFC3339(): string
-
Returns string
dayjs
- get dayjs(): Dayjs
-
Returns Dayjs
fromNow
- get fromNow(): string
-
Returns string
isValid
- get isValid(): boolean
-
Returns boolean
ms
- get ms(): number
-
Returns number
timestamp
- get timestamp(): number
-
Returns number
toNow
- get toNow(): string
-
Returns string
Methods
Private
_tz
- _tz(date: TimeDate, timezone?: string): Dayjs
-
Parameters
-
-
Optional
timezone: string
Returns Dayjs
diff
- diff(comparisonDate: Time, unit?: TimeUnit, isTruncated?: boolean): number
-
Parameters
-
comparisonDate: Time
-
-
isTruncated: boolean = false
Returns number
format
- format(format?: string): string
-
Returns string
get
- get(unit: TimeUnit): number
-
Returns number
getAsObject
- getAsObject(unit: TimeUnit[]): {
D: number;
M: number;
d: number;
date: number;
dates: number;
day: number;
days: number;
h: number;
hour: number;
hours: number;
m: number;
millisecond: number;
milliseconds: number;
minute: number;
minutes: number;
month: number;
months: number;
ms: number;
s: number;
second: number;
seconds: number;
y: number;
year: number;
years: number;
}
-
Returns {
D: number;
M: number;
d: number;
date: number;
dates: number;
day: number;
days: number;
h: number;
hour: number;
hours: number;
m: number;
millisecond: number;
milliseconds: number;
minute: number;
minutes: number;
month: number;
months: number;
ms: number;
s: number;
second: number;
seconds: number;
y: number;
year: number;
years: number;
}
-
D: number
-
M: number
-
d: number
-
date: number
-
dates: number
-
day: number
-
days: number
-
h: number
-
hour: number
-
hours: number
-
m: number
-
millisecond: number
-
milliseconds: number
-
minute: number
-
minutes: number
-
month: number
-
months: number
-
ms: number
-
s: number
-
second: number
-
seconds: number
-
y: number
-
year: number
-
years: number
getFrom
- getFrom(date: TimeDate): string
-
Returns string
getTo
- getTo(date: TimeDate): string
-
Returns string
isAfter
- isAfter(comparisonDate?: TimeDate): boolean
-
Returns boolean
isBefore
- isBefore(comparisonDate?: TimeDate): boolean
-
Returns boolean
isSameOrAfter
- isSameOrAfter(comparisonDate?: TimeDate): boolean
-
Returns boolean
isSameOrBefore
- isSameOrBefore(comparisonDate?: TimeDate): boolean
-
Returns boolean
toCalendar
- toCalendar(referenceTime?: TimeDate, calendar?: Partial<{
lastDay: string;
lastWeek: string;
nextDay: string;
nextWeek: string;
sameDay: string;
sameElse: string;
}>): string
-
Parameters
-
Optional
referenceTime: TimeDate
-
Optional
calendar: Partial<{
lastDay: string;
lastWeek: string;
nextDay: string;
nextWeek: string;
sameDay: string;
sameElse: string;
}>
Returns string
toDate
- toDate(): Date
-
Returns Date
tz
- tz(timezone?: string): Time
-
Parameters
-
Optional
timezone: string
utc
- utc(keepLocalTime?: boolean): Time
-
Parameters
-
Optional
keepLocalTime: boolean
Static
locale
- locale(preset?: string | ILocale, object?: Partial<ILocale>, isLocal?: boolean): string
-
Parameters
-
Optional
preset: string | ILocale
-
Optional
object: Partial<ILocale>
-
Optional
isLocal: boolean
Returns string
Static
setDefaultTimezone
- setDefaultTimezone(timezone?: string): void
-
Parameters
-
Optional
timezone: string
Returns void
Static
setLocale
- setLocale(localeName: string, customConfig: Partial<{
calendar: Partial<{
lastDay: string;
lastWeek: string;
nextDay: string;
nextWeek: string;
sameDay: string;
sameElse: string;
}>;
formats: {
L: string;
LL: string;
LLL: string;
LLLL: string;
LT: string;
LTS: string;
l: string;
ll: string;
lll: string;
llll: string;
};
meridiem: ((hour?: number, minute?: number, isLowercase?: boolean) => string);
months: string[];
monthsShort: string[];
name: string;
ordinal: ((n: number) => string);
relativeTime: {
M: string;
MM: string;
d: string;
dd: string;
future: string;
h: string;
hh: string;
m: string;
mm: string;
past: string;
s: string;
y: string;
yy: string;
};
weekStart: number;
weekdays: string[];
weekdaysMin: string[];
weekdaysShort: string[];
yearStart: number;
}>): Partial<{
calendar: Partial<{
lastDay: string;
lastWeek: string;
nextDay: string;
nextWeek: string;
sameDay: string;
sameElse: string;
}>;
formats: {
L: string;
LL: string;
LLL: string;
LLLL: string;
LT: string;
LTS: string;
l: string;
ll: string;
lll: string;
llll: string;
};
meridiem: ((hour?: number, minute?: number, isLowercase?: boolean) => string);
months: string[];
monthsShort: string[];
name: string;
ordinal: ((n: number) => string);
relativeTime: {
M: string;
MM: string;
d: string;
dd: string;
future: string;
h: string;
hh: string;
m: string;
mm: string;
past: string;
s: string;
y: string;
yy: string;
};
weekStart: number;
weekdays: string[];
weekdaysMin: string[];
weekdaysShort: string[];
yearStart: number;
}>
-
Parameters
-
localeName: string
-
customConfig: Partial<{
calendar: Partial<{
lastDay: string;
lastWeek: string;
nextDay: string;
nextWeek: string;
sameDay: string;
sameElse: string;
}>;
formats: {
L: string;
LL: string;
LLL: string;
LLLL: string;
LT: string;
LTS: string;
l: string;
ll: string;
lll: string;
llll: string;
};
meridiem: ((hour?: number, minute?: number, isLowercase?: boolean) => string);
months: string[];
monthsShort: string[];
name: string;
ordinal: ((n: number) => string);
relativeTime: {
M: string;
MM: string;
d: string;
dd: string;
future: string;
h: string;
hh: string;
m: string;
mm: string;
past: string;
s: string;
y: string;
yy: string;
};
weekStart: number;
weekdays: string[];
weekdaysMin: string[];
weekdaysShort: string[];
yearStart: number;
}>
Returns Partial<{
calendar: Partial<{
lastDay: string;
lastWeek: string;
nextDay: string;
nextWeek: string;
sameDay: string;
sameElse: string;
}>;
formats: {
L: string;
LL: string;
LLL: string;
LLLL: string;
LT: string;
LTS: string;
l: string;
ll: string;
lll: string;
llll: string;
};
meridiem: ((hour?: number, minute?: number, isLowercase?: boolean) => string);
months: string[];
monthsShort: string[];
name: string;
ordinal: ((n: number) => string);
relativeTime: {
M: string;
MM: string;
d: string;
dd: string;
future: string;
h: string;
hh: string;
m: string;
mm: string;
past: string;
s: string;
y: string;
yy: string;
};
weekStart: number;
weekdays: string[];
weekdaysMin: string[];
weekdaysShort: string[];
yearStart: number;
}>