@tsdotnet/date-time 1.0.29 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/CalendarDate.d.ts +1 -0
- package/dist/Calendars/Gregorian.d.ts +30 -37
- package/dist/ClockTime.d.ts +20 -20
- package/dist/ClockTimeValue.d.ts +1 -0
- package/dist/DateTime.d.ts +154 -154
- package/dist/DateTimeKind.d.ts +10 -15
- package/dist/JsDateConvertible.d.ts +1 -0
- package/dist/TimeMeasurement.d.ts +1 -0
- package/dist/TimeQuantity.d.ts +50 -50
- package/dist/TimeSpan.d.ts +73 -73
- package/dist/TimeStamp.d.ts +25 -25
- package/dist/TimeStampValue.d.ts +1 -0
- package/dist/TimeUnit.d.ts +47 -47
- package/dist/TimeUnitValue.d.ts +19 -19
- package/dist/cjs/Calendars/Gregorian.js +7 -0
- package/dist/cjs/Calendars/Gregorian.js.map +1 -0
- package/dist/{ClockTime.js → cjs/ClockTime.js} +69 -67
- package/dist/cjs/ClockTime.js.map +1 -0
- package/dist/{DateTime.js → cjs/DateTime.js} +306 -305
- package/dist/cjs/DateTime.js.map +1 -0
- package/dist/cjs/DateTimeKind.js +7 -0
- package/dist/cjs/DateTimeKind.js.map +1 -0
- package/dist/{TimeQuantity.js → cjs/TimeQuantity.js} +95 -95
- package/dist/cjs/TimeQuantity.js.map +1 -0
- package/dist/{TimeSpan.js → cjs/TimeSpan.js} +112 -111
- package/dist/cjs/TimeSpan.js.map +1 -0
- package/dist/{TimeStamp.js → cjs/TimeStamp.js} +46 -45
- package/dist/cjs/TimeStamp.js.map +1 -0
- package/dist/{TimeUnit.js → cjs/TimeUnit.js} +100 -99
- package/dist/cjs/TimeUnit.js.map +1 -0
- package/dist/{TimeUnitValue.js → cjs/TimeUnitValue.js} +46 -46
- package/dist/cjs/TimeUnitValue.js.map +1 -0
- package/dist/{date-time.js → cjs/date-time.js} +24 -24
- package/dist/cjs/date-time.js.map +1 -0
- package/dist/cjs/howMany.js +53 -0
- package/dist/cjs/howMany.js.map +1 -0
- package/dist/date-time.d.ts +21 -20
- package/dist/esm/Calendars/Gregorian.js +6 -0
- package/dist/esm/Calendars/Gregorian.js.map +1 -0
- package/{dist-esm → dist/esm}/ClockTime.js +70 -62
- package/dist/esm/ClockTime.js.map +1 -0
- package/{dist-esm → dist/esm}/DateTime.js +305 -301
- package/dist/esm/DateTime.js.map +1 -0
- package/dist/esm/DateTimeKind.js +6 -0
- package/dist/esm/DateTimeKind.js.map +1 -0
- package/{dist-esm → dist/esm}/TimeQuantity.js +93 -91
- package/dist/esm/TimeQuantity.js.map +1 -0
- package/{dist-esm → dist/esm}/TimeSpan.js +132 -106
- package/dist/esm/TimeSpan.js.map +1 -0
- package/{dist-esm → dist/esm}/TimeStamp.js +49 -40
- package/dist/esm/TimeStamp.js.map +1 -0
- package/{dist-esm → dist/esm}/TimeUnit.js +97 -96
- package/dist/esm/TimeUnit.js.map +1 -0
- package/{dist-esm → dist/esm}/TimeUnitValue.js +43 -42
- package/dist/esm/TimeUnitValue.js.map +1 -0
- package/{dist-esm → dist/esm}/date-time.js +13 -13
- package/dist/esm/date-time.js.map +1 -0
- package/dist/esm/howMany.js +50 -0
- package/dist/esm/howMany.js.map +1 -0
- package/dist/howMany.d.ts +39 -59
- package/dist/umd/Calendars/Gregorian.js +17 -0
- package/dist/umd/Calendars/Gregorian.js.map +1 -0
- package/dist/umd/ClockTime.js +86 -0
- package/dist/umd/ClockTime.js.map +1 -0
- package/dist/umd/DateTime.js +320 -0
- package/dist/umd/DateTime.js.map +1 -0
- package/dist/umd/DateTimeKind.js +17 -0
- package/dist/umd/DateTimeKind.js.map +1 -0
- package/dist/umd/TimeQuantity.js +108 -0
- package/dist/umd/TimeQuantity.js.map +1 -0
- package/dist/umd/TimeSpan.js +148 -0
- package/dist/umd/TimeSpan.js.map +1 -0
- package/dist/umd/TimeStamp.js +65 -0
- package/dist/umd/TimeStamp.js.map +1 -0
- package/dist/umd/TimeUnit.js +111 -0
- package/dist/umd/TimeUnit.js.map +1 -0
- package/dist/umd/TimeUnitValue.js +58 -0
- package/dist/umd/TimeUnitValue.js.map +1 -0
- package/dist/umd/date-time.js +35 -0
- package/dist/umd/date-time.js.map +1 -0
- package/dist/umd/howMany.js +63 -0
- package/dist/umd/howMany.js.map +1 -0
- package/eslint.config.mjs +25 -0
- package/package.json +97 -62
- package/dist/ClockTime.js.map +0 -1
- package/dist/DateTime.js.map +0 -1
- package/dist/TimeQuantity.js.map +0 -1
- package/dist/TimeSpan.js.map +0 -1
- package/dist/TimeStamp.js.map +0 -1
- package/dist/TimeUnit.js.map +0 -1
- package/dist/TimeUnitValue.js.map +0 -1
- package/dist/date-time.js.map +0 -1
- package/dist-esm/ClockTime.js.map +0 -1
- package/dist-esm/DateTime.js.map +0 -1
- package/dist-esm/TimeQuantity.js.map +0 -1
- package/dist-esm/TimeSpan.js.map +0 -1
- package/dist-esm/TimeStamp.js.map +0 -1
- package/dist-esm/TimeUnit.js.map +0 -1
- package/dist-esm/TimeUnitValue.js.map +0 -1
- package/dist-esm/date-time.js.map +0 -1
package/dist/TimeSpan.d.ts
CHANGED
|
@@ -1,73 +1,73 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* @author electricessence / https://github.com/electricessence/
|
|
3
|
-
* Originally based upon .NET source but with many additions and improvements.
|
|
4
|
-
* @license MIT
|
|
5
|
-
*/
|
|
6
|
-
import ClockTime from './ClockTime';
|
|
7
|
-
import TimeMeasurement from './TimeMeasurement';
|
|
8
|
-
import TimeQuantity from './TimeQuantity';
|
|
9
|
-
import TimeUnit from './TimeUnit';
|
|
10
|
-
/**
|
|
11
|
-
* TimeSpan expands on TimeQuantity to provide an class that is similar to .NET's TimeSpan including many useful static methods.
|
|
12
|
-
*/
|
|
13
|
-
export declare class TimeSpan extends TimeQuantity implements TimeMeasurement {
|
|
14
|
-
/**
|
|
15
|
-
* The total number of ticks that represent this amount of time.
|
|
16
|
-
*/
|
|
17
|
-
readonly ticks: number;
|
|
18
|
-
/**
|
|
19
|
-
* The total number of ticks that milliseconds this amount of time.
|
|
20
|
-
*/
|
|
21
|
-
readonly milliseconds: number;
|
|
22
|
-
/**
|
|
23
|
-
* The total number of ticks that seconds this amount of time.
|
|
24
|
-
*/
|
|
25
|
-
readonly seconds: number;
|
|
26
|
-
/**
|
|
27
|
-
* The total number of ticks that minutes this amount of time.
|
|
28
|
-
*/
|
|
29
|
-
readonly minutes: number;
|
|
30
|
-
/**
|
|
31
|
-
* The total number of ticks that hours this amount of time.
|
|
32
|
-
*/
|
|
33
|
-
readonly hours: number;
|
|
34
|
-
/**
|
|
35
|
-
* The total number of ticks that days this amount of time.
|
|
36
|
-
*/
|
|
37
|
-
readonly days: number;
|
|
38
|
-
protected constructor(value: number, units?: TimeUnit.UnitType);
|
|
39
|
-
static get zero(): TimeSpan;
|
|
40
|
-
/**
|
|
41
|
-
* Provides an standard interface for acquiring the total time.
|
|
42
|
-
* @returns {TimeSpan}
|
|
43
|
-
*/
|
|
44
|
-
get total(): TimeSpan;
|
|
45
|
-
private _time;
|
|
46
|
-
/**
|
|
47
|
-
* The value of this TimeSpan reduced to the clock and calendar.
|
|
48
|
-
* @return {ClockTime}
|
|
49
|
-
*/
|
|
50
|
-
get time(): ClockTime;
|
|
51
|
-
static from(values: Partial<TimeMeasurement>): TimeSpan;
|
|
52
|
-
static from(value: number, units: TimeUnit.UnitType): TimeSpan;
|
|
53
|
-
static fromDays(value: number): TimeSpan;
|
|
54
|
-
static fromHours(value: number): TimeSpan;
|
|
55
|
-
static fromMinutes(value: number): TimeSpan;
|
|
56
|
-
static fromSeconds(value: number): TimeSpan;
|
|
57
|
-
static fromMilliseconds(value: number): TimeSpan;
|
|
58
|
-
static fromTicks(value: number): TimeSpan;
|
|
59
|
-
/**
|
|
60
|
-
* Sum the value of this TimeSpan with another time quantity.
|
|
61
|
-
* @param {TimeQuantity | Partial<TimeMeasurement>} other
|
|
62
|
-
* @return {TimeSpan}
|
|
63
|
-
*/
|
|
64
|
-
add(other: TimeSpan | TimeQuantity | Partial<TimeMeasurement>): TimeSpan;
|
|
65
|
-
/**
|
|
66
|
-
* Sum the value of this TimeSpan with another unit value.
|
|
67
|
-
* @param {number} value
|
|
68
|
-
* @param {TimeUnit.UnitType} units
|
|
69
|
-
* @return {TimeSpan}
|
|
70
|
-
*/
|
|
71
|
-
addUnit(value: number, units?: TimeUnit.UnitType): TimeSpan;
|
|
72
|
-
}
|
|
73
|
-
export default TimeSpan;
|
|
1
|
+
/*!
|
|
2
|
+
* @author electricessence / https://github.com/electricessence/
|
|
3
|
+
* Originally based upon .NET source but with many additions and improvements.
|
|
4
|
+
* @license MIT
|
|
5
|
+
*/
|
|
6
|
+
import ClockTime from './ClockTime';
|
|
7
|
+
import TimeMeasurement from './TimeMeasurement';
|
|
8
|
+
import TimeQuantity from './TimeQuantity';
|
|
9
|
+
import TimeUnit from './TimeUnit';
|
|
10
|
+
/**
|
|
11
|
+
* TimeSpan expands on TimeQuantity to provide an class that is similar to .NET's TimeSpan including many useful static methods.
|
|
12
|
+
*/
|
|
13
|
+
export declare class TimeSpan extends TimeQuantity implements TimeMeasurement {
|
|
14
|
+
/**
|
|
15
|
+
* The total number of ticks that represent this amount of time.
|
|
16
|
+
*/
|
|
17
|
+
readonly ticks: number;
|
|
18
|
+
/**
|
|
19
|
+
* The total number of ticks that milliseconds this amount of time.
|
|
20
|
+
*/
|
|
21
|
+
readonly milliseconds: number;
|
|
22
|
+
/**
|
|
23
|
+
* The total number of ticks that seconds this amount of time.
|
|
24
|
+
*/
|
|
25
|
+
readonly seconds: number;
|
|
26
|
+
/**
|
|
27
|
+
* The total number of ticks that minutes this amount of time.
|
|
28
|
+
*/
|
|
29
|
+
readonly minutes: number;
|
|
30
|
+
/**
|
|
31
|
+
* The total number of ticks that hours this amount of time.
|
|
32
|
+
*/
|
|
33
|
+
readonly hours: number;
|
|
34
|
+
/**
|
|
35
|
+
* The total number of ticks that days this amount of time.
|
|
36
|
+
*/
|
|
37
|
+
readonly days: number;
|
|
38
|
+
protected constructor(value: number, units?: TimeUnit.UnitType);
|
|
39
|
+
static get zero(): TimeSpan;
|
|
40
|
+
/**
|
|
41
|
+
* Provides an standard interface for acquiring the total time.
|
|
42
|
+
* @returns {TimeSpan}
|
|
43
|
+
*/
|
|
44
|
+
get total(): TimeSpan;
|
|
45
|
+
private _time;
|
|
46
|
+
/**
|
|
47
|
+
* The value of this TimeSpan reduced to the clock and calendar.
|
|
48
|
+
* @return {ClockTime}
|
|
49
|
+
*/
|
|
50
|
+
get time(): ClockTime;
|
|
51
|
+
static from(values: Partial<TimeMeasurement>): TimeSpan;
|
|
52
|
+
static from(value: number, units: TimeUnit.UnitType): TimeSpan;
|
|
53
|
+
static fromDays(value: number): TimeSpan;
|
|
54
|
+
static fromHours(value: number): TimeSpan;
|
|
55
|
+
static fromMinutes(value: number): TimeSpan;
|
|
56
|
+
static fromSeconds(value: number): TimeSpan;
|
|
57
|
+
static fromMilliseconds(value: number): TimeSpan;
|
|
58
|
+
static fromTicks(value: number): TimeSpan;
|
|
59
|
+
/**
|
|
60
|
+
* Sum the value of this TimeSpan with another time quantity.
|
|
61
|
+
* @param {TimeQuantity | Partial<TimeMeasurement>} other
|
|
62
|
+
* @return {TimeSpan}
|
|
63
|
+
*/
|
|
64
|
+
add(other: TimeSpan | TimeQuantity | Partial<TimeMeasurement>): TimeSpan;
|
|
65
|
+
/**
|
|
66
|
+
* Sum the value of this TimeSpan with another unit value.
|
|
67
|
+
* @param {number} value
|
|
68
|
+
* @param {TimeUnit.UnitType} units
|
|
69
|
+
* @return {TimeSpan}
|
|
70
|
+
*/
|
|
71
|
+
addUnit(value: number, units?: TimeUnit.UnitType): TimeSpan;
|
|
72
|
+
}
|
|
73
|
+
export default TimeSpan;
|
package/dist/TimeStamp.d.ts
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* @author electricessence / https://github.com/electricessence/
|
|
3
|
-
* @license MIT
|
|
4
|
-
*/
|
|
5
|
-
import Gregorian from './Calendars/Gregorian';
|
|
6
|
-
import JsDateConvertible from './JsDateConvertible';
|
|
7
|
-
import TimeStampValue from './TimeStampValue';
|
|
8
|
-
/**
|
|
9
|
-
* An alternative to Date or DateTime. Is a model representing the exact date and time.
|
|
10
|
-
*/
|
|
11
|
-
export declare class TimeStamp implements Required<TimeStampValue>, JsDateConvertible {
|
|
12
|
-
readonly year: number;
|
|
13
|
-
readonly month: Gregorian.Month;
|
|
14
|
-
readonly day: number;
|
|
15
|
-
readonly hour: number;
|
|
16
|
-
readonly minute: number;
|
|
17
|
-
readonly second: number;
|
|
18
|
-
readonly millisecond: number;
|
|
19
|
-
readonly tick: number;
|
|
20
|
-
constructor(year: number, month: Gregorian.Month, day?: number, hour?: number, minute?: number, second?: number, millisecond?: number, tick?: number);
|
|
21
|
-
static from(d: Date | JsDateConvertible): TimeStamp;
|
|
22
|
-
static now(): TimeStamp;
|
|
23
|
-
toJsDate(): Date;
|
|
24
|
-
}
|
|
25
|
-
export default TimeStamp;
|
|
1
|
+
/*!
|
|
2
|
+
* @author electricessence / https://github.com/electricessence/
|
|
3
|
+
* @license MIT
|
|
4
|
+
*/
|
|
5
|
+
import Gregorian from './Calendars/Gregorian';
|
|
6
|
+
import JsDateConvertible from './JsDateConvertible';
|
|
7
|
+
import TimeStampValue from './TimeStampValue';
|
|
8
|
+
/**
|
|
9
|
+
* An alternative to Date or DateTime. Is a model representing the exact date and time.
|
|
10
|
+
*/
|
|
11
|
+
export declare class TimeStamp implements Required<TimeStampValue>, JsDateConvertible {
|
|
12
|
+
readonly year: number;
|
|
13
|
+
readonly month: Gregorian.Month;
|
|
14
|
+
readonly day: number;
|
|
15
|
+
readonly hour: number;
|
|
16
|
+
readonly minute: number;
|
|
17
|
+
readonly second: number;
|
|
18
|
+
readonly millisecond: number;
|
|
19
|
+
readonly tick: number;
|
|
20
|
+
constructor(year: number, month: Gregorian.Month, day?: number, hour?: number, minute?: number, second?: number, millisecond?: number, tick?: number);
|
|
21
|
+
static from(d: Date | JsDateConvertible): TimeStamp;
|
|
22
|
+
static now(): TimeStamp;
|
|
23
|
+
toJsDate(): Date;
|
|
24
|
+
}
|
|
25
|
+
export default TimeStamp;
|
package/dist/TimeStampValue.d.ts
CHANGED
package/dist/TimeUnit.d.ts
CHANGED
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* @author electricessence / https://github.com/electricessence/
|
|
3
|
-
* Originally based upon .NET source but with many additions and improvements.
|
|
4
|
-
* @license MIT
|
|
5
|
-
*/
|
|
6
|
-
import TimeQuantity from './TimeQuantity';
|
|
7
|
-
export declare namespace TimeUnit {
|
|
8
|
-
/**
|
|
9
|
-
* A distinct unit of time measurement.
|
|
10
|
-
*/
|
|
11
|
-
enum UnitType {
|
|
12
|
-
Ticks = 0,
|
|
13
|
-
Milliseconds = 1,
|
|
14
|
-
Seconds = 2,
|
|
15
|
-
Minutes = 3,
|
|
16
|
-
Hours = 4,
|
|
17
|
-
Days = 5
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Converts any TimeUnit value to it's respective millisecond quantity.
|
|
21
|
-
* @param {number} value
|
|
22
|
-
* @param {UnitType} units
|
|
23
|
-
* @return {number} Number of milliseconds representing the specified units.
|
|
24
|
-
*/
|
|
25
|
-
function toMilliseconds(value: number, units: UnitType): number;
|
|
26
|
-
/**
|
|
27
|
-
* Converts milliseconds to the specified TimeUnit quantity.
|
|
28
|
-
* @param {number} ms
|
|
29
|
-
* @param {UnitType} units
|
|
30
|
-
* @return {number}
|
|
31
|
-
*/
|
|
32
|
-
function fromMilliseconds(ms: number, units: UnitType): number;
|
|
33
|
-
/**
|
|
34
|
-
* Converts a TimeQuantity to the the TimeUnit requested..
|
|
35
|
-
* @param {TimeQuantity} quantity
|
|
36
|
-
* @param {UnitType} toUnits
|
|
37
|
-
* @return {number}
|
|
38
|
-
*/
|
|
39
|
-
function from(quantity: TimeQuantity, toUnits: UnitType): number;
|
|
40
|
-
/**
|
|
41
|
-
* Asserts if the time unit value is valid.
|
|
42
|
-
* @param {UnitType} unit
|
|
43
|
-
* @return {true}
|
|
44
|
-
*/
|
|
45
|
-
function assertValid(unit: UnitType): true | never;
|
|
46
|
-
}
|
|
47
|
-
export default TimeUnit;
|
|
1
|
+
/*!
|
|
2
|
+
* @author electricessence / https://github.com/electricessence/
|
|
3
|
+
* Originally based upon .NET source but with many additions and improvements.
|
|
4
|
+
* @license MIT
|
|
5
|
+
*/
|
|
6
|
+
import TimeQuantity from './TimeQuantity';
|
|
7
|
+
export declare namespace TimeUnit {
|
|
8
|
+
/**
|
|
9
|
+
* A distinct unit of time measurement.
|
|
10
|
+
*/
|
|
11
|
+
enum UnitType {
|
|
12
|
+
Ticks = 0,
|
|
13
|
+
Milliseconds = 1,
|
|
14
|
+
Seconds = 2,
|
|
15
|
+
Minutes = 3,
|
|
16
|
+
Hours = 4,
|
|
17
|
+
Days = 5
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Converts any TimeUnit value to it's respective millisecond quantity.
|
|
21
|
+
* @param {number} value
|
|
22
|
+
* @param {UnitType} units
|
|
23
|
+
* @return {number} Number of milliseconds representing the specified units.
|
|
24
|
+
*/
|
|
25
|
+
function toMilliseconds(value: number, units: UnitType): number;
|
|
26
|
+
/**
|
|
27
|
+
* Converts milliseconds to the specified TimeUnit quantity.
|
|
28
|
+
* @param {number} ms
|
|
29
|
+
* @param {UnitType} units
|
|
30
|
+
* @return {number}
|
|
31
|
+
*/
|
|
32
|
+
function fromMilliseconds(ms: number, units: UnitType): number;
|
|
33
|
+
/**
|
|
34
|
+
* Converts a TimeQuantity to the the TimeUnit requested..
|
|
35
|
+
* @param {TimeQuantity} quantity
|
|
36
|
+
* @param {UnitType} toUnits
|
|
37
|
+
* @return {number}
|
|
38
|
+
*/
|
|
39
|
+
function from(quantity: TimeQuantity, toUnits: UnitType): number;
|
|
40
|
+
/**
|
|
41
|
+
* Asserts if the time unit value is valid.
|
|
42
|
+
* @param {UnitType} unit
|
|
43
|
+
* @return {true}
|
|
44
|
+
*/
|
|
45
|
+
function assertValid(unit: UnitType): true | never;
|
|
46
|
+
}
|
|
47
|
+
export default TimeUnit;
|
package/dist/TimeUnitValue.d.ts
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* @author electricessence / https://github.com/electricessence/
|
|
3
|
-
* @license MIT
|
|
4
|
-
*/
|
|
5
|
-
import TimeQuantity from './TimeQuantity';
|
|
6
|
-
import TimeUnit from './TimeUnit';
|
|
7
|
-
/**
|
|
8
|
-
* TimeUnitValue allows for passing around a reference to a mutable measure of time coerced by its unit type.
|
|
9
|
-
*/
|
|
10
|
-
export default class TimeUnitValue extends TimeQuantity {
|
|
11
|
-
private _units;
|
|
12
|
-
constructor(value: number | TimeQuantity, _units: TimeUnit.UnitType);
|
|
13
|
-
get value(): number;
|
|
14
|
-
set value(v: number);
|
|
15
|
-
get units(): TimeUnit.UnitType;
|
|
16
|
-
static from(value: number | TimeQuantity, units?: TimeUnit.UnitType): TimeUnitValue;
|
|
17
|
-
getTotalMilliseconds(): number;
|
|
18
|
-
to(units?: TimeUnit.UnitType): TimeUnitValue;
|
|
19
|
-
}
|
|
1
|
+
/*!
|
|
2
|
+
* @author electricessence / https://github.com/electricessence/
|
|
3
|
+
* @license MIT
|
|
4
|
+
*/
|
|
5
|
+
import TimeQuantity from './TimeQuantity';
|
|
6
|
+
import TimeUnit from './TimeUnit';
|
|
7
|
+
/**
|
|
8
|
+
* TimeUnitValue allows for passing around a reference to a mutable measure of time coerced by its unit type.
|
|
9
|
+
*/
|
|
10
|
+
export default class TimeUnitValue extends TimeQuantity {
|
|
11
|
+
private _units;
|
|
12
|
+
constructor(value: number | TimeQuantity, _units: TimeUnit.UnitType);
|
|
13
|
+
get value(): number;
|
|
14
|
+
set value(v: number);
|
|
15
|
+
get units(): TimeUnit.UnitType;
|
|
16
|
+
static from(value: number | TimeQuantity, units?: TimeUnit.UnitType): TimeUnitValue;
|
|
17
|
+
getTotalMilliseconds(): number;
|
|
18
|
+
to(units?: TimeUnit.UnitType): TimeUnitValue;
|
|
19
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Gregorian.js","sourceRoot":"","sources":["../../../src/Calendars/Gregorian.ts"],"names":[],"mappings":";AAAA;;;GAGG"}
|
|
@@ -1,68 +1,70 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*!
|
|
3
|
-
* @author electricessence / https://github.com/electricessence/
|
|
4
|
-
* @license MIT
|
|
5
|
-
*/
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.ClockTime = void 0;
|
|
8
|
-
const tslib_1 = require("tslib");
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
this.
|
|
21
|
-
msi -= this.
|
|
22
|
-
this.
|
|
23
|
-
msi -= this.
|
|
24
|
-
this.
|
|
25
|
-
msi -= this.
|
|
26
|
-
this.
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
value
|
|
37
|
-
value *=
|
|
38
|
-
value +=
|
|
39
|
-
value *=
|
|
40
|
-
value +=
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
if (_.
|
|
50
|
-
a.push(pluralize(_.
|
|
51
|
-
if (_.
|
|
52
|
-
a.push(pluralize(_.
|
|
53
|
-
if (_.
|
|
54
|
-
a.push(pluralize(_.
|
|
55
|
-
if (
|
|
56
|
-
a.
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
/*!
|
|
3
|
+
* @author electricessence / https://github.com/electricessence/
|
|
4
|
+
* @license MIT
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.ClockTime = void 0;
|
|
8
|
+
const tslib_1 = require("tslib");
|
|
9
|
+
const howMany = tslib_1.__importStar(require("./howMany"));
|
|
10
|
+
const TimeQuantity_1 = tslib_1.__importDefault(require("./TimeQuantity"));
|
|
11
|
+
var msPer = howMany.milliseconds.per;
|
|
12
|
+
class ClockTime extends TimeQuantity_1.default {
|
|
13
|
+
constructor(...args) {
|
|
14
|
+
super(args.length > 1
|
|
15
|
+
? ClockTime.millisecondsFromTime(args[0] || 0, args[1] || 0, args.length > 2 && args[2] || 0, args.length > 3 && args[3] || 0)
|
|
16
|
+
: (args.length > 0 && args[0] || 0));
|
|
17
|
+
const ms = Math.abs(this.getTotalMilliseconds());
|
|
18
|
+
let msi = Math.floor(ms);
|
|
19
|
+
this.tick = (ms - msi) * howMany.ticks.per.millisecond;
|
|
20
|
+
this.day = (msi / msPer.day) | 0;
|
|
21
|
+
msi -= this.day * howMany.milliseconds.per.day;
|
|
22
|
+
this.hour = (msi / msPer.hour) | 0;
|
|
23
|
+
msi -= this.hour * msPer.hour;
|
|
24
|
+
this.minute = (msi / msPer.minute) | 0;
|
|
25
|
+
msi -= this.minute * msPer.minute;
|
|
26
|
+
this.second = (msi / msPer.second) | 0;
|
|
27
|
+
msi -= this.second * msPer.second;
|
|
28
|
+
this.millisecond = msi;
|
|
29
|
+
Object.freeze(this);
|
|
30
|
+
}
|
|
31
|
+
// Static version for relative consistency. Constructor does allow this format.
|
|
32
|
+
static from(hours, minutes, seconds = 0, milliseconds = 0) {
|
|
33
|
+
return new ClockTime(hours, minutes, seconds, milliseconds);
|
|
34
|
+
}
|
|
35
|
+
static millisecondsFromTime(hours, minutes, seconds = 0, milliseconds = 0) {
|
|
36
|
+
let value = hours;
|
|
37
|
+
value *= howMany.minutes.per.hour;
|
|
38
|
+
value += minutes;
|
|
39
|
+
value *= howMany.seconds.per.minute;
|
|
40
|
+
value += seconds;
|
|
41
|
+
value *= howMany.milliseconds.per.second;
|
|
42
|
+
value += milliseconds;
|
|
43
|
+
return value;
|
|
44
|
+
}
|
|
45
|
+
toString( /*format?:string, formatProvider?:IFormatProvider*/) {
|
|
46
|
+
/* INSERT CUSTOM FORMATTING CODE HERE */
|
|
47
|
+
const _ = this;
|
|
48
|
+
const a = [];
|
|
49
|
+
if (_.day)
|
|
50
|
+
a.push(pluralize(_.day, 'day'));
|
|
51
|
+
if (_.hour)
|
|
52
|
+
a.push(pluralize(_.hour, 'hour'));
|
|
53
|
+
if (_.minute)
|
|
54
|
+
a.push(pluralize(_.minute, 'minute'));
|
|
55
|
+
if (_.second)
|
|
56
|
+
a.push(pluralize(_.second, 'second'));
|
|
57
|
+
if (a.length > 1)
|
|
58
|
+
a.splice(a.length - 1, 0, 'and');
|
|
59
|
+
return a.join(', ').replace(', and, ', ' and ');
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
exports.ClockTime = ClockTime;
|
|
63
|
+
// Temporary until the full TimeSpanFormat is available.
|
|
64
|
+
function pluralize(value, label) {
|
|
65
|
+
if (Math.abs(value) !== 1)
|
|
66
|
+
label += 's';
|
|
67
|
+
return label;
|
|
68
|
+
}
|
|
69
|
+
exports.default = ClockTime;
|
|
68
70
|
//# sourceMappingURL=ClockTime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ClockTime.js","sourceRoot":"","sources":["../../src/ClockTime.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;AAGH,2DAAqC;AACrC,0EAA0C;AAC1C,IAAO,KAAK,GAAG,OAAO,CAAC,YAAY,CAAC,GAAG,CAAC;AAExC,MAAa,SACZ,S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