@tsdotnet/date-time 1.0.28 → 1.0.33
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/LICENSE +21 -21
- package/README.md +11 -11
- package/dist/CalendarDate.d.ts +12 -0
- package/dist/Calendars/Gregorian.d.ts +37 -37
- package/dist/ClockTime.d.ts +20 -20
- package/dist/ClockTime.js +67 -67
- package/dist/ClockTime.js.map +1 -1
- package/dist/ClockTimeValue.d.ts +14 -0
- package/dist/DateTime.d.ts +154 -154
- package/dist/DateTime.js +305 -305
- package/dist/DateTime.js.map +1 -1
- package/dist/DateTimeKind.d.ts +15 -0
- package/dist/JsDateConvertible.d.ts +10 -0
- package/dist/TimeMeasurement.d.ts +15 -0
- package/dist/TimeQuantity.d.ts +50 -50
- package/dist/TimeQuantity.js +95 -95
- package/dist/TimeQuantity.js.map +1 -1
- package/dist/TimeSpan.d.ts +73 -73
- package/dist/TimeSpan.js +111 -111
- package/dist/TimeSpan.js.map +1 -1
- package/dist/TimeStamp.d.ts +25 -25
- package/dist/TimeStamp.js +45 -45
- package/dist/TimeStamp.js.map +1 -1
- package/dist/TimeStampValue.d.ts +13 -0
- package/dist/TimeUnit.d.ts +47 -47
- package/dist/TimeUnit.js +99 -99
- package/dist/TimeUnit.js.map +1 -1
- package/dist/TimeUnitValue.d.ts +19 -19
- package/dist/TimeUnitValue.js +46 -46
- package/dist/TimeUnitValue.js.map +1 -1
- package/dist/date-time.d.ts +20 -20
- package/dist/date-time.js +28 -24
- package/dist/date-time.js.map +1 -1
- package/dist/howMany.d.ts +39 -0
- package/dist/howMany.js +53 -0
- package/dist/howMany.js.map +1 -0
- package/dist-esm/ClockTime.js +62 -62
- package/dist-esm/ClockTime.js.map +1 -1
- package/dist-esm/DateTime.js +301 -301
- package/dist-esm/DateTime.js.map +1 -1
- package/dist-esm/TimeQuantity.js +91 -91
- package/dist-esm/TimeQuantity.js.map +1 -1
- package/dist-esm/TimeSpan.js +106 -106
- package/dist-esm/TimeSpan.js.map +1 -1
- package/dist-esm/TimeStamp.js +40 -40
- package/dist-esm/TimeStamp.js.map +1 -1
- package/dist-esm/TimeUnit.js +96 -96
- package/dist-esm/TimeUnit.js.map +1 -1
- package/dist-esm/TimeUnitValue.js +42 -42
- package/dist-esm/date-time.js +15 -13
- package/dist-esm/date-time.js.map +1 -1
- package/dist-esm/howMany.js +50 -0
- package/dist-esm/howMany.js.map +1 -0
- package/package.json +81 -62
package/dist-esm/TimeUnit.js
CHANGED
|
@@ -1,97 +1,97 @@
|
|
|
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
|
-
/* eslint-disable no-fallthrough */
|
|
7
|
-
export var TimeUnit;
|
|
8
|
-
(function (TimeUnit) {
|
|
9
|
-
/**
|
|
10
|
-
* A distinct unit of time measurement.
|
|
11
|
-
*/
|
|
12
|
-
let UnitType;
|
|
13
|
-
(function (UnitType) {
|
|
14
|
-
UnitType[UnitType["Ticks"] = 0] = "Ticks";
|
|
15
|
-
UnitType[UnitType["Milliseconds"] = 1] = "Milliseconds";
|
|
16
|
-
UnitType[UnitType["Seconds"] = 2] = "Seconds";
|
|
17
|
-
UnitType[UnitType["Minutes"] = 3] = "Minutes";
|
|
18
|
-
UnitType[UnitType["Hours"] = 4] = "Hours";
|
|
19
|
-
UnitType[UnitType["Days"] = 5] = "Days";
|
|
20
|
-
})(UnitType = TimeUnit.UnitType || (TimeUnit.UnitType = {})); // Earth Days
|
|
21
|
-
/**
|
|
22
|
-
* Converts any TimeUnit value to it's respective millisecond quantity.
|
|
23
|
-
* @param {number} value
|
|
24
|
-
* @param {UnitType} units
|
|
25
|
-
* @return {number} Number of milliseconds representing the specified units.
|
|
26
|
-
*/
|
|
27
|
-
function toMilliseconds(value, units) {
|
|
28
|
-
// noinspection FallThroughInSwitchStatementJS
|
|
29
|
-
switch (units) {
|
|
30
|
-
case UnitType.Days:
|
|
31
|
-
value *= 24 /* day */;
|
|
32
|
-
case UnitType.Hours:
|
|
33
|
-
value *= 60 /* hour */;
|
|
34
|
-
case UnitType.Minutes:
|
|
35
|
-
value *= 60 /* minute */;
|
|
36
|
-
case UnitType.Seconds:
|
|
37
|
-
value *= 1000 /* second */;
|
|
38
|
-
case UnitType.Milliseconds:
|
|
39
|
-
return value;
|
|
40
|
-
case UnitType.Ticks:
|
|
41
|
-
return value / 10000 /* millisecond */;
|
|
42
|
-
default:
|
|
43
|
-
throw new Error('Invalid TimeUnit.');
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
TimeUnit.toMilliseconds = toMilliseconds;
|
|
47
|
-
/**
|
|
48
|
-
* Converts milliseconds to the specified TimeUnit quantity.
|
|
49
|
-
* @param {number} ms
|
|
50
|
-
* @param {UnitType} units
|
|
51
|
-
* @return {number}
|
|
52
|
-
*/
|
|
53
|
-
function fromMilliseconds(ms, units) {
|
|
54
|
-
switch (units) {
|
|
55
|
-
case UnitType.Days:
|
|
56
|
-
return ms / 86400000 /* day */;
|
|
57
|
-
case UnitType.Hours:
|
|
58
|
-
return ms / 3600000 /* hour */;
|
|
59
|
-
case UnitType.Minutes:
|
|
60
|
-
return ms / 60000 /* minute */;
|
|
61
|
-
case UnitType.Seconds:
|
|
62
|
-
return ms / 1000 /* second */;
|
|
63
|
-
case UnitType.Milliseconds:
|
|
64
|
-
return ms;
|
|
65
|
-
case UnitType.Ticks:
|
|
66
|
-
return ms * 10000 /* millisecond */;
|
|
67
|
-
default:
|
|
68
|
-
throw new Error('Invalid TimeUnit.');
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
TimeUnit.fromMilliseconds = fromMilliseconds;
|
|
72
|
-
/**
|
|
73
|
-
* Converts a TimeQuantity to the the TimeUnit requested..
|
|
74
|
-
* @param {TimeQuantity} quantity
|
|
75
|
-
* @param {UnitType} toUnits
|
|
76
|
-
* @return {number}
|
|
77
|
-
*/
|
|
78
|
-
function from(quantity, toUnits) {
|
|
79
|
-
return quantity && fromMilliseconds(quantity.getTotalMilliseconds(), toUnits);
|
|
80
|
-
}
|
|
81
|
-
TimeUnit.from = from;
|
|
82
|
-
/**
|
|
83
|
-
* Asserts if the time unit value is valid.
|
|
84
|
-
* @param {UnitType} unit
|
|
85
|
-
* @return {true}
|
|
86
|
-
*/
|
|
87
|
-
function assertValid(unit) {
|
|
88
|
-
if (isNaN(unit) || unit > UnitType.Days || unit < UnitType.Ticks || Math.floor(unit) !== unit)
|
|
89
|
-
throw new Error('Invalid TimeUnit.');
|
|
90
|
-
return true;
|
|
91
|
-
}
|
|
92
|
-
TimeUnit.assertValid = assertValid;
|
|
93
|
-
})(TimeUnit || (TimeUnit = {}));
|
|
94
|
-
Object.freeze(TimeUnit.UnitType);
|
|
95
|
-
Object.freeze(TimeUnit);
|
|
96
|
-
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
|
+
/* eslint-disable no-fallthrough */
|
|
7
|
+
export var TimeUnit;
|
|
8
|
+
(function (TimeUnit) {
|
|
9
|
+
/**
|
|
10
|
+
* A distinct unit of time measurement.
|
|
11
|
+
*/
|
|
12
|
+
let UnitType;
|
|
13
|
+
(function (UnitType) {
|
|
14
|
+
UnitType[UnitType["Ticks"] = 0] = "Ticks";
|
|
15
|
+
UnitType[UnitType["Milliseconds"] = 1] = "Milliseconds";
|
|
16
|
+
UnitType[UnitType["Seconds"] = 2] = "Seconds";
|
|
17
|
+
UnitType[UnitType["Minutes"] = 3] = "Minutes";
|
|
18
|
+
UnitType[UnitType["Hours"] = 4] = "Hours";
|
|
19
|
+
UnitType[UnitType["Days"] = 5] = "Days";
|
|
20
|
+
})(UnitType = TimeUnit.UnitType || (TimeUnit.UnitType = {})); // Earth Days
|
|
21
|
+
/**
|
|
22
|
+
* Converts any TimeUnit value to it's respective millisecond quantity.
|
|
23
|
+
* @param {number} value
|
|
24
|
+
* @param {UnitType} units
|
|
25
|
+
* @return {number} Number of milliseconds representing the specified units.
|
|
26
|
+
*/
|
|
27
|
+
function toMilliseconds(value, units) {
|
|
28
|
+
// noinspection FallThroughInSwitchStatementJS
|
|
29
|
+
switch (units) {
|
|
30
|
+
case UnitType.Days:
|
|
31
|
+
value *= 24 /* hours.per.day */;
|
|
32
|
+
case UnitType.Hours:
|
|
33
|
+
value *= 60 /* minutes.per.hour */;
|
|
34
|
+
case UnitType.Minutes:
|
|
35
|
+
value *= 60 /* seconds.per.minute */;
|
|
36
|
+
case UnitType.Seconds:
|
|
37
|
+
value *= 1000 /* milliseconds.per.second */;
|
|
38
|
+
case UnitType.Milliseconds:
|
|
39
|
+
return value;
|
|
40
|
+
case UnitType.Ticks:
|
|
41
|
+
return value / 10000 /* ticks.per.millisecond */;
|
|
42
|
+
default:
|
|
43
|
+
throw new Error('Invalid TimeUnit.');
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
TimeUnit.toMilliseconds = toMilliseconds;
|
|
47
|
+
/**
|
|
48
|
+
* Converts milliseconds to the specified TimeUnit quantity.
|
|
49
|
+
* @param {number} ms
|
|
50
|
+
* @param {UnitType} units
|
|
51
|
+
* @return {number}
|
|
52
|
+
*/
|
|
53
|
+
function fromMilliseconds(ms, units) {
|
|
54
|
+
switch (units) {
|
|
55
|
+
case UnitType.Days:
|
|
56
|
+
return ms / 86400000 /* milliseconds.per.day */;
|
|
57
|
+
case UnitType.Hours:
|
|
58
|
+
return ms / 3600000 /* milliseconds.per.hour */;
|
|
59
|
+
case UnitType.Minutes:
|
|
60
|
+
return ms / 60000 /* milliseconds.per.minute */;
|
|
61
|
+
case UnitType.Seconds:
|
|
62
|
+
return ms / 1000 /* milliseconds.per.second */;
|
|
63
|
+
case UnitType.Milliseconds:
|
|
64
|
+
return ms;
|
|
65
|
+
case UnitType.Ticks:
|
|
66
|
+
return ms * 10000 /* ticks.per.millisecond */;
|
|
67
|
+
default:
|
|
68
|
+
throw new Error('Invalid TimeUnit.');
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
TimeUnit.fromMilliseconds = fromMilliseconds;
|
|
72
|
+
/**
|
|
73
|
+
* Converts a TimeQuantity to the the TimeUnit requested..
|
|
74
|
+
* @param {TimeQuantity} quantity
|
|
75
|
+
* @param {UnitType} toUnits
|
|
76
|
+
* @return {number}
|
|
77
|
+
*/
|
|
78
|
+
function from(quantity, toUnits) {
|
|
79
|
+
return quantity && fromMilliseconds(quantity.getTotalMilliseconds(), toUnits);
|
|
80
|
+
}
|
|
81
|
+
TimeUnit.from = from;
|
|
82
|
+
/**
|
|
83
|
+
* Asserts if the time unit value is valid.
|
|
84
|
+
* @param {UnitType} unit
|
|
85
|
+
* @return {true}
|
|
86
|
+
*/
|
|
87
|
+
function assertValid(unit) {
|
|
88
|
+
if (isNaN(unit) || unit > UnitType.Days || unit < UnitType.Ticks || Math.floor(unit) !== unit)
|
|
89
|
+
throw new Error('Invalid TimeUnit.');
|
|
90
|
+
return true;
|
|
91
|
+
}
|
|
92
|
+
TimeUnit.assertValid = assertValid;
|
|
93
|
+
})(TimeUnit || (TimeUnit = {}));
|
|
94
|
+
Object.freeze(TimeUnit.UnitType);
|
|
95
|
+
Object.freeze(TimeUnit);
|
|
96
|
+
export default TimeUnit;
|
|
97
97
|
//# sourceMappingURL=TimeUnit.js.map
|
package/dist-esm/TimeUnit.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TimeUnit.js","sourceRoot":"","sources":["../src/TimeUnit.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,mCAAmC;AAEnC,MAAM,KAAW,QAAQ,CAmGxB;AAnGD,WAAiB,QAAQ;IAExB;;OAEG;IACH,IAAY,QAQX;IARD,WAAY,QAAQ;QAEnB,yCAAK,CAAA;QACL,uDAAY,CAAA;QACZ,6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Q,CAAC,CAAC;AAExB,eAAe,QAAQ,CAAC"}
|
|
@@ -1,43 +1,43 @@
|
|
|
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
|
-
constructor(value, _units) {
|
|
12
|
-
super(typeof value == 'number'
|
|
13
|
-
? value
|
|
14
|
-
: getUnitQuantityFrom(value, _units));
|
|
15
|
-
this._units = _units;
|
|
16
|
-
TimeUnit.assertValid(_units);
|
|
17
|
-
}
|
|
18
|
-
get value() {
|
|
19
|
-
return this._quantity;
|
|
20
|
-
}
|
|
21
|
-
set value(v) {
|
|
22
|
-
this._quantity = v;
|
|
23
|
-
if (!this._total.tryReset())
|
|
24
|
-
throw new Error('Unable to update underlying value.');
|
|
25
|
-
}
|
|
26
|
-
// To avoid confusion, the unit type can only be set once at construction.
|
|
27
|
-
get units() {
|
|
28
|
-
return this._units;
|
|
29
|
-
}
|
|
30
|
-
static from(value, units = TimeUnit.UnitType.Milliseconds) {
|
|
31
|
-
return new TimeUnitValue(value, units);
|
|
32
|
-
}
|
|
33
|
-
getTotalMilliseconds() {
|
|
34
|
-
return TimeUnit.toMilliseconds(this._quantity, this._units);
|
|
35
|
-
}
|
|
36
|
-
to(units = this.units) {
|
|
37
|
-
return TimeUnitValue.from(this, units);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
function getUnitQuantityFrom(q, units) {
|
|
41
|
-
return TimeUnit.fromMilliseconds(q.getTotalMilliseconds(), units);
|
|
42
|
-
}
|
|
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
|
+
constructor(value, _units) {
|
|
12
|
+
super(typeof value == 'number'
|
|
13
|
+
? value
|
|
14
|
+
: getUnitQuantityFrom(value, _units));
|
|
15
|
+
this._units = _units;
|
|
16
|
+
TimeUnit.assertValid(_units);
|
|
17
|
+
}
|
|
18
|
+
get value() {
|
|
19
|
+
return this._quantity;
|
|
20
|
+
}
|
|
21
|
+
set value(v) {
|
|
22
|
+
this._quantity = v;
|
|
23
|
+
if (!this._total.tryReset())
|
|
24
|
+
throw new Error('Unable to update underlying value.');
|
|
25
|
+
}
|
|
26
|
+
// To avoid confusion, the unit type can only be set once at construction.
|
|
27
|
+
get units() {
|
|
28
|
+
return this._units;
|
|
29
|
+
}
|
|
30
|
+
static from(value, units = TimeUnit.UnitType.Milliseconds) {
|
|
31
|
+
return new TimeUnitValue(value, units);
|
|
32
|
+
}
|
|
33
|
+
getTotalMilliseconds() {
|
|
34
|
+
return TimeUnit.toMilliseconds(this._quantity, this._units);
|
|
35
|
+
}
|
|
36
|
+
to(units = this.units) {
|
|
37
|
+
return TimeUnitValue.from(this, units);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
function getUnitQuantityFrom(q, units) {
|
|
41
|
+
return TimeUnit.fromMilliseconds(q.getTotalMilliseconds(), units);
|
|
42
|
+
}
|
|
43
43
|
//# sourceMappingURL=TimeUnitValue.js.map
|
package/dist-esm/date-time.js
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* @author electricessence / https://github.com/electricessence/
|
|
3
|
-
* @license MIT
|
|
4
|
-
*/
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
|
|
1
|
+
/*!
|
|
2
|
+
* @author electricessence / https://github.com/electricessence/
|
|
3
|
+
* @license MIT
|
|
4
|
+
*/
|
|
5
|
+
import Gregorian from './Calendars/Gregorian';
|
|
6
|
+
import ClockTime from './ClockTime';
|
|
7
|
+
import DateTime from './DateTime';
|
|
8
|
+
import DateTimeKind from './DateTimeKind';
|
|
9
|
+
import * as howMany from './howMany';
|
|
10
|
+
import TimeQuantity from './TimeQuantity';
|
|
11
|
+
import TimeSpan from './TimeSpan';
|
|
12
|
+
import TimeStamp from './TimeStamp';
|
|
13
|
+
import TimeUnit from './TimeUnit';
|
|
14
|
+
import TimeUnitValue from './TimeUnitValue';
|
|
15
|
+
export { Gregorian, ClockTime, DateTime, DateTimeKind, howMany, TimeQuantity, TimeSpan, TimeStamp, TimeUnit, TimeUnitValue };
|
|
14
16
|
//# sourceMappingURL=date-time.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date-time.js","sourceRoot":"","sources":["../src/date-time.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"date-time.js","sourceRoot":"","sources":["../src/date-time.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,SAAS,MAAM,uBAAuB,CAAC;AAE9C,OAAO,SAAS,MAAM,aAAa,CAAC;AAEpC,OAAO,QAAQ,MAAM,YAAY,CAAC;AAClC,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;AAErC,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAC1C,OAAO,QAAQ,MAAM,YAAY,CAAC;AAClC,OAAO,SAAS,MAAM,aAAa,CAAC;AAEpC,OAAO,QAAQ,MAAM,YAAY,CAAC;AAClC,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAI5C,OAAO,EACN,SAAS,EAET,SAAS,EAET,QAAQ,EACR,YAAY,EACZ,OAAO,EAEP,YAAY,EACZ,QAAQ,EACR,SAAS,EAET,QAAQ,EACR,aAAa,EAEb,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* @author electricessence / https://github.com/electricessence/
|
|
3
|
+
* @license MIT
|
|
4
|
+
*/
|
|
5
|
+
export var hours;
|
|
6
|
+
(function (hours) {
|
|
7
|
+
let per;
|
|
8
|
+
(function (per) {
|
|
9
|
+
per[per["day"] = 24] = "day";
|
|
10
|
+
})(per = hours.per || (hours.per = {}));
|
|
11
|
+
})(hours || (hours = {}));
|
|
12
|
+
export var minutes;
|
|
13
|
+
(function (minutes) {
|
|
14
|
+
let per;
|
|
15
|
+
(function (per) {
|
|
16
|
+
per[per["hour"] = 60] = "hour";
|
|
17
|
+
per[per["day"] = 1440] = "day";
|
|
18
|
+
})(per = minutes.per || (minutes.per = {}));
|
|
19
|
+
})(minutes || (minutes = {}));
|
|
20
|
+
export var seconds;
|
|
21
|
+
(function (seconds) {
|
|
22
|
+
let per;
|
|
23
|
+
(function (per) {
|
|
24
|
+
per[per["minute"] = 60] = "minute";
|
|
25
|
+
per[per["hour"] = 3600] = "hour";
|
|
26
|
+
per[per["day"] = 86400] = "day";
|
|
27
|
+
})(per = seconds.per || (seconds.per = {}));
|
|
28
|
+
})(seconds || (seconds = {}));
|
|
29
|
+
export var milliseconds;
|
|
30
|
+
(function (milliseconds) {
|
|
31
|
+
let per;
|
|
32
|
+
(function (per) {
|
|
33
|
+
per[per["second"] = 1000] = "second";
|
|
34
|
+
per[per["minute"] = 60000] = "minute";
|
|
35
|
+
per[per["hour"] = 3600000] = "hour";
|
|
36
|
+
per[per["day"] = 86400000] = "day";
|
|
37
|
+
})(per = milliseconds.per || (milliseconds.per = {}));
|
|
38
|
+
})(milliseconds || (milliseconds = {}));
|
|
39
|
+
export var ticks;
|
|
40
|
+
(function (ticks) {
|
|
41
|
+
let per;
|
|
42
|
+
(function (per) {
|
|
43
|
+
per[per["millisecond"] = 10000] = "millisecond";
|
|
44
|
+
per[per["second"] = 10000000] = "second";
|
|
45
|
+
per[per["minute"] = 600000000] = "minute";
|
|
46
|
+
per[per["hour"] = 36000000000] = "hour";
|
|
47
|
+
per[per["day"] = 864000000000] = "day";
|
|
48
|
+
})(per = ticks.per || (ticks.per = {}));
|
|
49
|
+
})(ticks || (ticks = {}));
|
|
50
|
+
//# sourceMappingURL=howMany.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"howMany.js","sourceRoot":"","sources":["../src/howMany.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,MAAM,KAAW,KAAK,CAMrB;AAND,WAAiB,KAAK;IAErB,IAAkB,GAGjB;IAHD,WAAkB,GAAG;QAEpB,4BAAQ,CAAA;IACT,CAAC,EAHiB,GAAG,GAAH,SAAG,KAAH,SAAG,QAGpB;AACF,CAAC,EANgB,KAAK,KAAL,KAAK,QAMrB;AAED,MAAM,KAAW,OAAO,CAQvB;AARD,WAAiB,OAAO;IAEvB,IAAkB,GAIjB;IAJD,WAAkB,GAAG;QAEpB,8BAAS,CAAA;QACT,8BAAyB,CAAA;IAC1B,CAAC,EAJiB,GAAG,GAAH,WAAG,KAAH,WAAG,QAIpB;AAEF,CAAC,EARgB,OAAO,KAAP,OAAO,QAQvB;AAED,MAAM,KAAW,OAAO,CASvB;AATD,WAAiB,OAAO;IAEvB,IAAkB,GAKjB;IALD,WAAkB,GAAG;QAEpB,kCAAW,CAAA;QACX,gCAAgC,CAAA;QAChC,+BAA2B,CAAA;IAC5B,CAAC,EALiB,GAAG,GAAH,WAAG,KAAH,WAAG,QAKpB;AAEF,CAAC,EATgB,OAAO,KAAP,OAAO,QASvB;AAED,MAAM,KAAW,YAAY,CAU5B;AAVD,WAAiB,YAAY;IAE5B,IAAkB,GAMjB;IAND,WAAkB,GAAG;QAEpB,oCAAa,CAAA;QACb,qCAAkC,CAAA;QAClC,mCAAgC,CAAA;QAChC,kCAA2B,CAAA;IAC5B,CAAC,EANiB,GAAG,GAAH,gBAAG,KAAH,gBAAG,QAMpB;AAEF,CAAC,EAVgB,YAAY,KAAZ,YAAY,QAU5B;AAED,MAAM,KAAW,KAAK,CAWrB;AAXD,WAAiB,KAAK;IAErB,IAAkB,GAOjB;IAPD,WAAkB,GAAG;QAEpB,+CAAmB,CAAA;QACnB,wCAAiD,CAAA;QACjD,yCAAuC,CAAA;QACvC,uCAAqC,CAAA;QACrC,sCAAgC,CAAA;IACjC,CAAC,EAPiB,GAAG,GAAH,SAAG,KAAH,SAAG,QAOpB;AAEF,CAAC,EAXgB,KAAK,KAAL,KAAK,QAWrB"}
|
package/package.json
CHANGED
|
@@ -1,62 +1,81 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@tsdotnet/date-time",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "",
|
|
5
|
-
"author": "electricessence",
|
|
6
|
-
"license": "MIT",
|
|
7
|
-
"types": "dist/date-time.d.ts",
|
|
8
|
-
"main": "dist/date-time.js",
|
|
9
|
-
"module": "dist-esm/date-time.js",
|
|
10
|
-
"keywords": [],
|
|
11
|
-
"scripts": {
|
|
12
|
-
"build:dist": "rimraf dist/* && tsc && copyfiles -u 1 src/**/*.d.ts dist",
|
|
13
|
-
"build:dist-esm": "rimraf dist-esm/* && tsc -p tsconfig.esm.json",
|
|
14
|
-
"build": "pnpm i && pnpm run build:dist && pnpm run build:dist-esm",
|
|
15
|
-
"bump": "npm run-script precommit && npm version patch",
|
|
16
|
-
"docs": "rimraf docs/* && typedoc --options typedoc.json --readme none",
|
|
17
|
-
"lint": "eslint src/**/*.ts",
|
|
18
|
-
"precommit": "pnpm i && run-p lint test && run-p build:* && npm run-script validate && git status -s",
|
|
19
|
-
"prepublishOnly": "npm run-script build && run-p validate test",
|
|
20
|
-
"preversion": "run-p lint test",
|
|
21
|
-
"postversion": "git push && git push --tags && npm run-script docs && git commit -m \"Updated docs.\" docs && git push",
|
|
22
|
-
"test": "mocha -r ts-node/register tests/**/*.ts",
|
|
23
|
-
"validate": "node ./.build/validate-package.js"
|
|
24
|
-
},
|
|
25
|
-
"repository": {
|
|
26
|
-
"type": "git",
|
|
27
|
-
"url": "git+https://github.com/tsdotnet/date-time.git"
|
|
28
|
-
},
|
|
29
|
-
"bugs": {
|
|
30
|
-
"url": "https://github.com/tsdotnet/date-time/issues"
|
|
31
|
-
},
|
|
32
|
-
"homepage": "https://github.com/tsdotnet/date-time#readme",
|
|
33
|
-
"devDependencies": {
|
|
34
|
-
"@tsdotnet/random": "^1.0.
|
|
35
|
-
"@types/chai": "^4.3.
|
|
36
|
-
"@types/mocha": "^
|
|
37
|
-
"@types/node": "^
|
|
38
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
39
|
-
"@typescript-eslint/parser": "^5.
|
|
40
|
-
"chai": "^4.3.
|
|
41
|
-
"copyfiles": "^2.4.1",
|
|
42
|
-
"eslint": "^8.
|
|
43
|
-
"eslint-config-typescript": "^3.0.0",
|
|
44
|
-
"eslint-plugin-import": "^2.
|
|
45
|
-
"eslint-plugin-node": "^11.1.0",
|
|
46
|
-
"eslint-plugin-promise": "^6.
|
|
47
|
-
"mocha": "^
|
|
48
|
-
"npm-run-all": "^4.1.5",
|
|
49
|
-
"nyc": "^15.1.0",
|
|
50
|
-
"rimraf": "^3.0.2",
|
|
51
|
-
"ts-node": "^10.
|
|
52
|
-
"typedoc": "^0.
|
|
53
|
-
"typescript": "^4.
|
|
54
|
-
},
|
|
55
|
-
"dependencies": {
|
|
56
|
-
"@tsdotnet/compare": "^1.3.
|
|
57
|
-
"@tsdotnet/exceptions": "^1.0.
|
|
58
|
-
"@tsdotnet/lazy": "^1.0.
|
|
59
|
-
"@tsdotnet/type": "^1.0.
|
|
60
|
-
"tslib": "^2.
|
|
61
|
-
}
|
|
62
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@tsdotnet/date-time",
|
|
3
|
+
"version": "1.0.33",
|
|
4
|
+
"description": "",
|
|
5
|
+
"author": "electricessence",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"types": "dist/date-time.d.ts",
|
|
8
|
+
"main": "dist/date-time.js",
|
|
9
|
+
"module": "dist-esm/date-time.js",
|
|
10
|
+
"keywords": [],
|
|
11
|
+
"scripts": {
|
|
12
|
+
"build:dist": "rimraf dist/* && tsc && copyfiles -u 1 src/**/*.d.ts dist",
|
|
13
|
+
"build:dist-esm": "rimraf dist-esm/* && tsc -p tsconfig.esm.json",
|
|
14
|
+
"build": "pnpm i && pnpm run build:dist && pnpm run build:dist-esm",
|
|
15
|
+
"bump": "npm run-script precommit && npm version patch",
|
|
16
|
+
"docs": "rimraf docs/* && typedoc --options typedoc.json --readme none",
|
|
17
|
+
"lint": "eslint src/**/*.ts",
|
|
18
|
+
"precommit": "pnpm i && run-p lint test && run-p build:* && npm run-script validate && git status -s",
|
|
19
|
+
"prepublishOnly": "npm run-script build && run-p validate test",
|
|
20
|
+
"preversion": "run-p lint test",
|
|
21
|
+
"postversion": "git push && git push --tags && npm run-script docs && git add -A && git commit -m \"Updated docs.\" docs && git push",
|
|
22
|
+
"test": "mocha -r ts-node/register tests/**/*.ts",
|
|
23
|
+
"validate": "node ./.build/validate-package.js"
|
|
24
|
+
},
|
|
25
|
+
"repository": {
|
|
26
|
+
"type": "git",
|
|
27
|
+
"url": "git+https://github.com/tsdotnet/date-time.git"
|
|
28
|
+
},
|
|
29
|
+
"bugs": {
|
|
30
|
+
"url": "https://github.com/tsdotnet/date-time/issues"
|
|
31
|
+
},
|
|
32
|
+
"homepage": "https://github.com/tsdotnet/date-time#readme",
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"@tsdotnet/random": "^1.0.17",
|
|
35
|
+
"@types/chai": "^4.3.4",
|
|
36
|
+
"@types/mocha": "^10.0.1",
|
|
37
|
+
"@types/node": "^18.11.17",
|
|
38
|
+
"@typescript-eslint/eslint-plugin": "^5.46.1",
|
|
39
|
+
"@typescript-eslint/parser": "^5.46.1",
|
|
40
|
+
"chai": "^4.3.7",
|
|
41
|
+
"copyfiles": "^2.4.1",
|
|
42
|
+
"eslint": "^8.30.0",
|
|
43
|
+
"eslint-config-typescript": "^3.0.0",
|
|
44
|
+
"eslint-plugin-import": "^2.26.0",
|
|
45
|
+
"eslint-plugin-node": "^11.1.0",
|
|
46
|
+
"eslint-plugin-promise": "^6.1.1",
|
|
47
|
+
"mocha": "^10.2.0",
|
|
48
|
+
"npm-run-all": "^4.1.5",
|
|
49
|
+
"nyc": "^15.1.0",
|
|
50
|
+
"rimraf": "^3.0.2",
|
|
51
|
+
"ts-node": "^10.9.1",
|
|
52
|
+
"typedoc": "^0.23.23",
|
|
53
|
+
"typescript": "^4.9.4"
|
|
54
|
+
},
|
|
55
|
+
"dependencies": {
|
|
56
|
+
"@tsdotnet/compare": "^1.3.22",
|
|
57
|
+
"@tsdotnet/exceptions": "^1.0.19",
|
|
58
|
+
"@tsdotnet/lazy": "^1.0.25",
|
|
59
|
+
"@tsdotnet/type": "^1.0.14",
|
|
60
|
+
"tslib": "^2.4.1"
|
|
61
|
+
},
|
|
62
|
+
"pnpm": {
|
|
63
|
+
"overrides": {
|
|
64
|
+
"hosted-git-info@<2.8.9": ">=2.8.9",
|
|
65
|
+
"y18n@=4.0.0": ">=4.0.1",
|
|
66
|
+
"lodash@<4.17.20": ">=4.17.20",
|
|
67
|
+
"shell-quote@<=1.7.2": ">=1.7.3",
|
|
68
|
+
"lodash@<4.17.21": ">=4.17.21",
|
|
69
|
+
"json5@<1.0.2": ">=1.0.2",
|
|
70
|
+
"json5@>=2.0.0 <2.2.2": ">=2.2.2",
|
|
71
|
+
"minimatch@<3.0.5": ">=3.0.5",
|
|
72
|
+
"word-wrap@<1.2.4": ">=1.2.4",
|
|
73
|
+
"semver@<5.7.2": ">=5.7.2",
|
|
74
|
+
"semver@>=6.0.0 <6.3.1": ">=6.3.1",
|
|
75
|
+
"semver@>=7.0.0 <7.5.2": ">=7.5.2",
|
|
76
|
+
"get-func-name@<2.0.1": ">=2.0.1",
|
|
77
|
+
"@babel/traverse@<7.23.2": ">=7.23.2",
|
|
78
|
+
"braces@<3.0.3": ">=3.0.3"
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|