-
Notifications
You must be signed in to change notification settings - Fork 0
/
IDurationFns.ts
169 lines (167 loc) · 4.56 KB
/
IDurationFns.ts
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
import { Iso } from '../iso-types'
import * as ES from '../ecmascript'
export interface IDurationFns {
fromNumbers(
years?: number,
months?: number,
weeks?: number,
days?: number,
hours?: number,
minute?: number,
seconds?: number,
milliseconds?: number
): Iso.Duration
isValid(duration: unknown): duration is Iso.Duration
assertIsValid(duration: unknown): asserts duration is Iso.Duration
getYears(duration: Iso.Duration): number
getMonths(duration: Iso.Duration): number
getWeeks(duration: Iso.Duration): number
getDays(duration: Iso.Duration): number
getHours(duration: Iso.Duration): number
getMinutes(duration: Iso.Duration): number
getSeconds(duration: Iso.Duration): number
getMilliseconds(duration: Iso.Duration): number
getSign(duration: Iso.Duration): number
isBlank(duration: Iso.Duration): boolean
with(
duration: Iso.Duration,
durationLike: {
years?: number
months?: number
weeks?: number
days?: number
hours?: number
minutes?: number
seconds?: number
milliseconds?: number
}
): Iso.Duration
negated(duration: Iso.Duration): Iso.Duration
abs(duration: Iso.Duration): Iso.Duration
add(
duration: Iso.Duration,
other:
| Iso.Duration
| {
years?: number
months?: number
weeks?: number
days?: number
hours?: number
minutes?: number
seconds?: number
milliseconds?: number
},
options?: { relativeTo: Iso.DateTime | Iso.ZonedDateTime }
): Iso.Duration
subtract(
duration: Iso.Duration,
other:
| Iso.Duration
| {
years?: number
months?: number
weeks?: number
days?: number
hours?: number
minutes?: number
seconds?: number
milliseconds?: number
},
options?: { relativeTo: Iso.DateTime | Iso.ZonedDateTime | Iso.Date }
): Iso.Duration
round(
duration: Iso.Duration,
options: {
largestUnit?: ES.TemporalSingularUnit | 'auto' | ES.TemporalPluralUnit
smallestUnit?: ES.TemporalSingularUnit | ES.TemporalPluralUnit
roundingIncrement?: number
roundingMode?: ES.TemporalRoundingMode
relativeTo?: Iso.DateTime | Iso.ZonedDateTime | Iso.Date
}
): Iso.Duration
total(
duration: Iso.Duration,
options: {
unit: ES.TemporalSingularUnit | ES.TemporalPluralUnit
relativeTo?: Iso.DateTime | Iso.ZonedDateTime | Iso.Date
}
): number
getFields(duration: Iso.Duration): ES.DurationSlots
from(item: any): Iso.Duration
compare(
one: Iso.Duration,
two: Iso.Duration,
options?: { relativeTo: Iso.DateTime | Iso.ZonedDateTime | Iso.Date }
): number
chain(duration: Iso.Duration): IDurationChain
}
/**
* @internal
*/
export interface IDurationChain extends ES.Chain<Iso.Duration> {
getYears(): ES.Chain<number>
getMonths(): ES.Chain<number>
getWeeks(): ES.Chain<number>
getDays(): ES.Chain<number>
getHours(): ES.Chain<number>
getMinutes(): ES.Chain<number>
getSeconds(): ES.Chain<number>
getMilliseconds(): ES.Chain<number>
getSign(): ES.Chain<number>
isBlank(): ES.Chain<boolean>
with(durationLike: {
years?: number
months?: number
weeks?: number
days?: number
hours?: number
minutes?: number
seconds?: number
milliseconds?: number
}): IDurationChain
negated(): IDurationChain
abs(): IDurationChain
add(
other:
| Iso.Duration
| {
years?: number
months?: number
weeks?: number
days?: number
hours?: number
minutes?: number
seconds?: number
milliseconds?: number
},
options?: { relativeTo: Iso.DateTime | Iso.ZonedDateTime }
): IDurationChain
subtract(
other:
| Iso.Duration
| {
years?: number
months?: number
weeks?: number
days?: number
hours?: number
minutes?: number
seconds?: number
milliseconds?: number
},
options?: { relativeTo: Iso.DateTime | Iso.ZonedDateTime | Iso.Date }
): IDurationChain
round(options: {
largestUnit?: ES.TemporalSingularUnit | 'auto'
smallestUnit?: ES.TemporalSingularUnit
roundingIncrement?: number
roundingMode?: ES.TemporalRoundingMode
relativeTo?: Iso.DateTime | Iso.ZonedDateTime | Iso.Date
}): IDurationChain
total(options: {
unit: ES.TemporalSingularUnit
relativeTo?: Iso.DateTime | Iso.ZonedDateTime | Iso.Date
}): ES.Chain<number>
getFields(): ES.Chain<ES.DurationSlots>
}