Interval
Classluxon 的时间区间类,表示一个有起止点的时间段,支持判断重叠、拆分、遍历等操作
Signature
class Interval {
static invalid(): void
static fromDateTimes(): void
static after(): void
static before(): void
static fromISO(): void
static isInterval(): void
static merge(): void
static xor(): void
length(): void
count(): void
hasSame(): void
isEmpty(): void
isAfter(): void
isBefore(): void
contains(): void
set(): void
splitAt(): void
splitBy(): void
divideEqually(): void
overlaps(): void
abutsStart(): void
abutsEnd(): void
engulfs(): void
equals(): void
intersection(): void
union(): void
difference(): void
toString(): void
toLocaleString(): void
toISO(): void
toISODate(): void
toISOTime(): void
toFormat(): void
toDuration(): void
mapEndpoints(): void
}Methods
- length()
- count()
- hasSame()
- isEmpty()
- isAfter()
- isBefore()
- contains()
- set()
- splitAt()
- splitBy()
- divideEqually()
- overlaps()
- abutsStart()
- abutsEnd()
- engulfs()
- equals()
- intersection()
- union()
- difference()
- toString()
- toLocaleString()
- toISO()
- toISODate()
- toISOTime()
- toFormat()
- toDuration()
- mapEndpoints()
- invalid() — static
- fromDateTimes() — static
- after() — static
- before() — static
- fromISO() — static
- isInterval() — static
- merge() — static
- xor() — static
Examples
Interval.fromDateTimes(DateTime.fromISO('2024-01-01'), DateTime.fromISO('2024-01-31')).length('days')Source
node_modules/.pnpm/@types+luxon@3.7.5/node_modules/@types/luxon/src/interval.d.ts:46