-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.d.ts
More file actions
67 lines (63 loc) · 1.74 KB
/
index.d.ts
File metadata and controls
67 lines (63 loc) · 1.74 KB
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
/**
* Parses a time string.
*
* If a meridian is given, automatically limits the
* maximum time to 24 hours.
*
* Upon successful parsing, returns the time as
* a {@link TimeDescriptor} object.
*
* If parsing was not successful, or the time is
* invalid, returns `undefined`.
*
* @param {string} time Time string input.
* @param {ParseTimeOptions} options An options object.
* @param {number} options.max The maximum (exclusive) total milliseconds to accept.
* @returns {TimeDescriptor} A {@link TimeDescriptor} object or `undefined`.
*/
export function parseTime(
time: string,
options?: ParseTimeOptions
): TimeDescriptor | undefined;
/**
* @alias parseTime
*/
export function timeParse(
time: string,
options?: ParseTimeOptions
): TimeDescriptor | undefined;
/**
* Parses the time of the day.
*
* Limits the maximum time to 24 hours (exclusive).
*
* Upon successful parsing, returns the time as
* a {@link TimeDescriptor} object.
*
* If parsing was not successful, or the time is
* invalid, returns `undefined`.
*
* @param {string} time
* @returns {TimeDescriptor} A {@link TimeDescriptor} object or `undefined`.
*/
export function parseTimeOfDay(time: string): TimeDescriptor | undefined;
/**
* Time relative to the start of the day.
*/
export interface TimeDescriptor {
/** The hour component. */
hours: number;
/** The minute component. */
minutes: number;
/** The total number of milliseconds since the start of the day. */
totalMs: number;
/** The total number of milliseconds since the start of the day. */
valueOf: () => number;
}
/**
* Time parsing options.
*/
export interface ParseTimeOptions {
/** The maximum (exclusive) total milliseconds to accept. */
max?: number;
}