@tsdotnet/date-time 1.0.23 → 1.0.27

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.
Files changed (44) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +11 -11
  3. package/dist/Calendars/Gregorian.d.ts +37 -37
  4. package/dist/ClockTime.d.ts +20 -20
  5. package/dist/ClockTime.js +67 -67
  6. package/dist/ClockTime.js.map +1 -1
  7. package/dist/DateTime.d.ts +154 -154
  8. package/dist/DateTime.js +305 -305
  9. package/dist/DateTime.js.map +1 -1
  10. package/dist/TimeQuantity.d.ts +50 -50
  11. package/dist/TimeQuantity.js +95 -95
  12. package/dist/TimeQuantity.js.map +1 -1
  13. package/dist/TimeSpan.d.ts +73 -73
  14. package/dist/TimeSpan.js +111 -111
  15. package/dist/TimeSpan.js.map +1 -1
  16. package/dist/TimeStamp.d.ts +25 -25
  17. package/dist/TimeStamp.js +45 -45
  18. package/dist/TimeStamp.js.map +1 -1
  19. package/dist/TimeUnit.d.ts +47 -47
  20. package/dist/TimeUnit.js +99 -99
  21. package/dist/TimeUnitValue.d.ts +19 -19
  22. package/dist/TimeUnitValue.js +46 -46
  23. package/dist/TimeUnitValue.js.map +1 -1
  24. package/dist/date-time.d.ts +20 -14
  25. package/dist/date-time.js +24 -24
  26. package/dist/date-time.js.map +1 -1
  27. package/dist-esm/ClockTime.js +62 -62
  28. package/dist-esm/ClockTime.js.map +1 -1
  29. package/dist-esm/DateTime.js +301 -301
  30. package/dist-esm/TimeQuantity.js +91 -91
  31. package/dist-esm/TimeSpan.js +106 -106
  32. package/dist-esm/TimeStamp.js +40 -40
  33. package/dist-esm/TimeUnit.js +96 -96
  34. package/dist-esm/TimeUnitValue.js +42 -42
  35. package/dist-esm/date-time.js +13 -13
  36. package/dist-esm/date-time.js.map +1 -1
  37. package/package.json +62 -62
  38. package/dist/CalendarDate.d.ts +0 -12
  39. package/dist/ClockTimeValue.d.ts +0 -14
  40. package/dist/DateTimeKind.d.ts +0 -15
  41. package/dist/JsDateConvertable.d.ts +0 -10
  42. package/dist/TimeMeasurement.d.ts +0 -15
  43. package/dist/TimeStampValue.d.ts +0 -13
  44. package/dist/howMany.d.ts +0 -59
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2021 electricessence (Oren F.)
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2021 electricessence (Oren F.)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,11 +1,11 @@
1
- # ![alt text](https://avatars1.githubusercontent.com/u/64487547?s=30 "tsdotnet") tsdotnet / date-time
2
-
3
- [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)](https://github.com/tsdotnet/date-time/blob/master/LICENSE)
4
- ![npm-publish](https://github.com/tsdotnet/date-time/workflows/npm-publish/badge.svg)
5
- [![npm version](https://img.shields.io/npm/v/@tsdotnet/date-time.svg?style=flat-square)](https://www.npmjs.com/package/@tsdotnet/date-time)
6
-
7
-
8
-
9
- ## Docs
10
-
11
- [tsdotnet.github.io/date-time](https://tsdotnet.github.io/date-time/modules/date_time.html)
1
+ # ![alt text](https://avatars1.githubusercontent.com/u/64487547?s=30 "tsdotnet") tsdotnet / date-time
2
+
3
+ [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)](https://github.com/tsdotnet/date-time/blob/master/LICENSE)
4
+ ![npm-publish](https://github.com/tsdotnet/date-time/workflows/npm-publish/badge.svg)
5
+ [![npm version](https://img.shields.io/npm/v/@tsdotnet/date-time.svg?style=flat-square)](https://www.npmjs.com/package/@tsdotnet/date-time)
6
+
7
+
8
+
9
+ ## Docs
10
+
11
+ [tsdotnet.github.io/date-time](https://tsdotnet.github.io/date-time/)
@@ -1,37 +1,37 @@
1
- /*!
2
- * @author electricessence / https://github.com/electricessence/
3
- * @license MIT
4
- */
5
-
6
- declare namespace Gregorian
7
- {
8
- export const enum Month
9
- {
10
- January,
11
- February,
12
- March,
13
- April,
14
- May,
15
- June,
16
- July,
17
- August,
18
- September,
19
- October,
20
- November,
21
- December
22
- }
23
-
24
- export const enum DayOfWeek
25
- {
26
- Sunday,
27
- Monday,
28
- Tuesday,
29
- Wednesday,
30
- Thursday,
31
- Friday,
32
- Saturday
33
- }
34
- }
35
-
36
- export default Gregorian;
37
-
1
+ /*!
2
+ * @author electricessence / https://github.com/electricessence/
3
+ * @license MIT
4
+ */
5
+
6
+ declare namespace Gregorian
7
+ {
8
+ export const enum Month
9
+ {
10
+ January,
11
+ February,
12
+ March,
13
+ April,
14
+ May,
15
+ June,
16
+ July,
17
+ August,
18
+ September,
19
+ October,
20
+ November,
21
+ December
22
+ }
23
+
24
+ export const enum DayOfWeek
25
+ {
26
+ Sunday,
27
+ Monday,
28
+ Tuesday,
29
+ Wednesday,
30
+ Thursday,
31
+ Friday,
32
+ Saturday
33
+ }
34
+ }
35
+
36
+ export default Gregorian;
37
+
@@ -1,20 +1,20 @@
1
- /*!
2
- * @author electricessence / https://github.com/electricessence/
3
- * @license MIT
4
- */
5
- import ClockTimeValue from './ClockTimeValue';
6
- import TimeQuantity from './TimeQuantity';
7
- export declare class ClockTime extends TimeQuantity implements Required<ClockTimeValue> {
8
- readonly day: number;
9
- readonly hour: number;
10
- readonly minute: number;
11
- readonly second: number;
12
- readonly millisecond: number;
13
- readonly tick: number;
14
- constructor(milliseconds: number);
15
- constructor(hours: number, minutes: number, seconds?: number, milliseconds?: number);
16
- static from(hours: number, minutes: number, seconds?: number, milliseconds?: number): ClockTime;
17
- static millisecondsFromTime(hours: number, minutes: number, seconds?: number, milliseconds?: number): number;
18
- toString(): string;
19
- }
20
- export default ClockTime;
1
+ /*!
2
+ * @author electricessence / https://github.com/electricessence/
3
+ * @license MIT
4
+ */
5
+ import ClockTimeValue from './ClockTimeValue';
6
+ import TimeQuantity from './TimeQuantity';
7
+ export declare class ClockTime extends TimeQuantity implements Required<ClockTimeValue> {
8
+ readonly day: number;
9
+ readonly hour: number;
10
+ readonly minute: number;
11
+ readonly second: number;
12
+ readonly millisecond: number;
13
+ readonly tick: number;
14
+ constructor(milliseconds: number);
15
+ constructor(hours: number, minutes: number, seconds?: number, milliseconds?: number);
16
+ static from(hours: number, minutes: number, seconds?: number, milliseconds?: number): ClockTime;
17
+ static millisecondsFromTime(hours: number, minutes: number, seconds?: number, milliseconds?: number): number;
18
+ toString(): string;
19
+ }
20
+ export default ClockTime;
package/dist/ClockTime.js CHANGED
@@ -1,68 +1,68 @@
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 TimeQuantity_1 = tslib_1.__importDefault(require("./TimeQuantity"));
10
- class ClockTime extends TimeQuantity_1.default {
11
- constructor(...args) {
12
- super(args.length > 1
13
- ? ClockTime.millisecondsFromTime(args[0] || 0, args[1] || 0, args.length > 2 && args[2] || 0, args.length > 3 && args[3] || 0)
14
- : (args.length > 0 && args[0] || 0));
15
- const ms = Math.abs(this.getTotalMilliseconds());
16
- let msi = Math.floor(ms);
17
- this.tick = (ms - msi) * 10000 /* millisecond */;
18
- this.day = (msi / 86400000 /* day */) | 0;
19
- msi -= this.day * 86400000 /* day */;
20
- this.hour = (msi / 3600000 /* hour */) | 0;
21
- msi -= this.hour * 3600000 /* hour */;
22
- this.minute = (msi / 60000 /* minute */) | 0;
23
- msi -= this.minute * 60000 /* minute */;
24
- this.second = (msi / 1000 /* second */) | 0;
25
- msi -= this.second * 1000 /* second */;
26
- this.millisecond = msi;
27
- Object.freeze(this);
28
- }
29
- // Static version for relative consistency. Constructor does allow this format.
30
- static from(hours, minutes, seconds = 0, milliseconds = 0) {
31
- return new ClockTime(hours, minutes, seconds, milliseconds);
32
- }
33
- static millisecondsFromTime(hours, minutes, seconds = 0, milliseconds = 0) {
34
- let value = hours;
35
- value *= 60 /* hour */;
36
- value += minutes;
37
- value *= 60 /* minute */;
38
- value += seconds;
39
- value *= 1000 /* second */;
40
- value += milliseconds;
41
- return value;
42
- }
43
- toString( /*format?:string, formatProvider?:IFormatProvider*/) {
44
- /* INSERT CUSTOM FORMATTING CODE HERE */
45
- const _ = this;
46
- const a = [];
47
- if (_.day)
48
- a.push(pluralize(_.day, 'day'));
49
- if (_.hour)
50
- a.push(pluralize(_.hour, 'hour'));
51
- if (_.minute)
52
- a.push(pluralize(_.minute, 'minute'));
53
- if (_.second)
54
- a.push(pluralize(_.second, 'second'));
55
- if (a.length > 1)
56
- a.splice(a.length - 1, 0, 'and');
57
- return a.join(', ').replace(', and, ', ' and ');
58
- }
59
- }
60
- exports.ClockTime = ClockTime;
61
- // Temporary until the full TimeSpanFormat is available.
62
- function pluralize(value, label) {
63
- if (Math.abs(value) !== 1)
64
- label += 's';
65
- return label;
66
- }
67
- exports.default = ClockTime;
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 TimeQuantity_1 = (0, tslib_1.__importDefault)(require("./TimeQuantity"));
10
+ class ClockTime extends TimeQuantity_1.default {
11
+ constructor(...args) {
12
+ super(args.length > 1
13
+ ? ClockTime.millisecondsFromTime(args[0] || 0, args[1] || 0, args.length > 2 && args[2] || 0, args.length > 3 && args[3] || 0)
14
+ : (args.length > 0 && args[0] || 0));
15
+ const ms = Math.abs(this.getTotalMilliseconds());
16
+ let msi = Math.floor(ms);
17
+ this.tick = (ms - msi) * 10000 /* millisecond */;
18
+ this.day = (msi / 86400000 /* day */) | 0;
19
+ msi -= this.day * 86400000 /* day */;
20
+ this.hour = (msi / 3600000 /* hour */) | 0;
21
+ msi -= this.hour * 3600000 /* hour */;
22
+ this.minute = (msi / 60000 /* minute */) | 0;
23
+ msi -= this.minute * 60000 /* minute */;
24
+ this.second = (msi / 1000 /* second */) | 0;
25
+ msi -= this.second * 1000 /* second */;
26
+ this.millisecond = msi;
27
+ Object.freeze(this);
28
+ }
29
+ // Static version for relative consistency. Constructor does allow this format.
30
+ static from(hours, minutes, seconds = 0, milliseconds = 0) {
31
+ return new ClockTime(hours, minutes, seconds, milliseconds);
32
+ }
33
+ static millisecondsFromTime(hours, minutes, seconds = 0, milliseconds = 0) {
34
+ let value = hours;
35
+ value *= 60 /* hour */;
36
+ value += minutes;
37
+ value *= 60 /* minute */;
38
+ value += seconds;
39
+ value *= 1000 /* second */;
40
+ value += milliseconds;
41
+ return value;
42
+ }
43
+ toString( /*format?:string, formatProvider?:IFormatProvider*/) {
44
+ /* INSERT CUSTOM FORMATTING CODE HERE */
45
+ const _ = this;
46
+ const a = [];
47
+ if (_.day)
48
+ a.push(pluralize(_.day, 'day'));
49
+ if (_.hour)
50
+ a.push(pluralize(_.hour, 'hour'));
51
+ if (_.minute)
52
+ a.push(pluralize(_.minute, 'minute'));
53
+ if (_.second)
54
+ a.push(pluralize(_.second, 'second'));
55
+ if (a.length > 1)
56
+ a.splice(a.length - 1, 0, 'and');
57
+ return a.join(', ').replace(', and, ', ' and ');
58
+ }
59
+ }
60
+ exports.ClockTime = ClockTime;
61
+ // Temporary until the full TimeSpanFormat is available.
62
+ function pluralize(value, label) {
63
+ if (Math.abs(value) !== 1)
64
+ label += 's';
65
+ return label;
66
+ }
67
+ exports.default = ClockTime;
68
68
  //# sourceMappingURL=ClockTime.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ClockTime.js","sourceRoot":"","sources":["../src/ClockTime.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;AAIH,0EAA0C;AAG1C,MAAa,SACZ,SAAQ,sBAAY;IAapB,YAAa,GAAG,IAAc;QAE7B,KAAK,CACJ,IAAI,CAAC,MAAM,GAAC,CAAC;YACZ,CAAC,CAAC,SAAS,CAAC,oBAAoB,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AC,SAAS,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC;QAEjC,IAAG,CAAC,CAAC,IAAI;YACR,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;QAEnC,IAAG,CAAC,CAAC,MAAM;YACV,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC;QAEvC,IAAG,CAAC,CAAC,MAAM;YACV,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC;QAEvC,IAAG,CAAC,CAAC,MAAM,GAAC,CAAC;YACZ,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC;QAElC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IACjD,CAAC;CAED;AAvGD,8BAuGC;AAGD,wDAAwD;AACxD,SAAS,SAAS,CAAE,KAAa,EAAE,KAAa;IAE/C,IAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,KAAG,CAAC;QACrB,KAAK,IAAI,GAAG,CAAC;IAEd,OAAO,KAAK,CAAC;AACd,CAAC;AAED,kBAAe,SAAS,CAAC"}
@@ -1,154 +1,154 @@
1
- /*!
2
- * @author electricessence / https://github.com/electricessence/
3
- * Based on .NET DateTime's interface.
4
- * @license MIT
5
- */
6
- import CalendarDate from './CalendarDate';
7
- import Gregorian from './Calendars/Gregorian';
8
- import ClockTime from './ClockTime';
9
- import DateTimeKind from './DateTimeKind';
10
- import JsDateConvertible from './JsDateConvertable';
11
- import TimeQuantity from './TimeQuantity';
12
- import TimeSpan from './TimeSpan';
13
- import TimeStamp from './TimeStamp';
14
- export default class DateTime implements CalendarDate, JsDateConvertible {
15
- private readonly _value;
16
- private readonly _kind;
17
- private _time;
18
- constructor();
19
- constructor(dateString: string, kind?: DateTimeKind);
20
- constructor(milliseconds: number, kind?: DateTimeKind);
21
- constructor(source: Date, kind?: DateTimeKind);
22
- constructor(source: DateTime, kind?: DateTimeKind);
23
- /**
24
- * Returns the now local time.
25
- * @returns {DateTime}
26
- */
27
- static get now(): DateTime;
28
- /**
29
- * The date component for now.
30
- * @returns {DateTime}
31
- */
32
- static get today(): DateTime;
33
- /**
34
- * Midnight tomorrow.
35
- * @returns {DateTime}
36
- */
37
- static get tomorrow(): DateTime;
38
- get kind(): DateTimeKind;
39
- get year(): number;
40
- /**
41
- * Returns the Gregorian Month (zero indexed).
42
- * @returns {number}
43
- */
44
- get month(): Gregorian.Month;
45
- /**
46
- * Returns the month number (1-12).
47
- * @returns {number}
48
- */
49
- get calendarMonth(): number;
50
- get calendar(): CalendarDate;
51
- /**
52
- * Returns the day of the month. An integer between 1 and 31.
53
- * @returns {number}
54
- */
55
- get day(): number;
56
- /**
57
- * Returns the day of the month indexed starting at zero.
58
- * @returns {number}
59
- */
60
- get dayIndex(): number;
61
- /**
62
- * Returns the zero indexed day of the week. (Sunday == 0)
63
- * @returns {number}
64
- */
65
- get dayOfWeek(): Gregorian.DayOfWeek;
66
- /**
67
- * Returns a DateTime object for 00:00 of this date.
68
- */
69
- get date(): DateTime;
70
- /**
71
- * Returns the time of day represented by a ClockTime object.
72
- * @returns {ClockTime}
73
- */
74
- get timeOfDay(): ClockTime;
75
- /**
76
- * Measures the difference between two dates as a TimeSpan.
77
- * @param first
78
- * @param last
79
- */
80
- static between(first: Date | DateTime, last: Date | DateTime): TimeSpan;
81
- /**
82
- * Calculates if the given year is a leap year using the formula:
83
- * ((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0)
84
- * @param year
85
- * @returns {boolean}
86
- */
87
- static isLeapYear(year: number): boolean;
88
- /**
89
- * Returns the number of days for the specific year and month.
90
- * @param year
91
- * @param month
92
- * @returns {any}
93
- */
94
- static daysInMonth(year: number, month: Gregorian.Month): number;
95
- static from(calendarDate: CalendarDate): DateTime;
96
- static from(year: number, month: Gregorian.Month, day: number): DateTime;
97
- static fromCalendarDate(calendarDate: CalendarDate): DateTime;
98
- static fromCalendarDate(year: number, month: number, day: number): DateTime;
99
- toJsDate(): Date;
100
- addMilliseconds(ms: number): DateTime;
101
- addSeconds(seconds: number): DateTime;
102
- addMinutes(minutes: number): DateTime;
103
- addHours(hours: number): DateTime;
104
- addDays(days: number): DateTime;
105
- addMonths(months: number): DateTime;
106
- addYears(years: number): DateTime;
107
- /**
108
- * Receives an TimeQuantity value and adds based on the total milliseconds.
109
- * @param {TimeQuantity} time
110
- * @returns {DateTime}
111
- */
112
- add(time: TimeQuantity): DateTime;
113
- /**
114
- * Receives an TimeQuantity value and subtracts based on the total milliseconds.
115
- * @param {TimeQuantity} time
116
- * @returns {DateTime}
117
- */
118
- subtract(time: TimeQuantity): DateTime;
119
- /**
120
- * Returns a TimeSpan representing the amount of time between two dates.
121
- * @param previous
122
- * @returns {TimeSpan}
123
- */
124
- timePassedSince(previous: Date | DateTime): TimeSpan;
125
- /**
126
- * Returns a readonly object which contains all the date and time components.
127
- */
128
- toTimeStamp(): TimeStamp;
129
- /**
130
- * Returns a UTC version of this date if its kind is local.
131
- * @returns {DateTime}
132
- */
133
- toUniversalTime(): DateTime;
134
- /**
135
- * Compares a JS Date with the current instance. Does not evaluate the kind.
136
- * @param other
137
- * @returns {boolean}
138
- */
139
- equals(other: Date): boolean;
140
- /**
141
- * Compares another JsDateConvertible object and returns true if they or their value are equal.
142
- * @param other The other JsDateConvertible object.
143
- * @param strict When strict is true, the 'kind' also must match.
144
- * @returns {boolean}
145
- */
146
- equals(other: JsDateConvertible, strict?: boolean): boolean;
147
- compareTo(other: Date | JsDateConvertible): number;
148
- /**
149
- * Returns true if the value is the same UTC time.
150
- * @param {Date | JsDateConvertible} other
151
- * @return {boolean}
152
- */
153
- equivalent(other: Date | JsDateConvertible): boolean;
154
- }
1
+ /*!
2
+ * @author electricessence / https://github.com/electricessence/
3
+ * Based on .NET DateTime's interface.
4
+ * @license MIT
5
+ */
6
+ import CalendarDate from './CalendarDate';
7
+ import Gregorian from './Calendars/Gregorian';
8
+ import ClockTime from './ClockTime';
9
+ import DateTimeKind from './DateTimeKind';
10
+ import JsDateConvertible from './JsDateConvertible';
11
+ import TimeQuantity from './TimeQuantity';
12
+ import TimeSpan from './TimeSpan';
13
+ import TimeStamp from './TimeStamp';
14
+ export default class DateTime implements CalendarDate, JsDateConvertible {
15
+ private readonly _value;
16
+ private readonly _kind;
17
+ private _time;
18
+ constructor();
19
+ constructor(dateString: string, kind?: DateTimeKind);
20
+ constructor(milliseconds: number, kind?: DateTimeKind);
21
+ constructor(source: Date, kind?: DateTimeKind);
22
+ constructor(source: DateTime, kind?: DateTimeKind);
23
+ /**
24
+ * Returns the now local time.
25
+ * @returns {DateTime}
26
+ */
27
+ static get now(): DateTime;
28
+ /**
29
+ * The date component for now.
30
+ * @returns {DateTime}
31
+ */
32
+ static get today(): DateTime;
33
+ /**
34
+ * Midnight tomorrow.
35
+ * @returns {DateTime}
36
+ */
37
+ static get tomorrow(): DateTime;
38
+ get kind(): DateTimeKind;
39
+ get year(): number;
40
+ /**
41
+ * Returns the Gregorian Month (zero indexed).
42
+ * @returns {number}
43
+ */
44
+ get month(): Gregorian.Month;
45
+ /**
46
+ * Returns the month number (1-12).
47
+ * @returns {number}
48
+ */
49
+ get calendarMonth(): number;
50
+ get calendar(): CalendarDate;
51
+ /**
52
+ * Returns the day of the month. An integer between 1 and 31.
53
+ * @returns {number}
54
+ */
55
+ get day(): number;
56
+ /**
57
+ * Returns the day of the month indexed starting at zero.
58
+ * @returns {number}
59
+ */
60
+ get dayIndex(): number;
61
+ /**
62
+ * Returns the zero indexed day of the week. (Sunday == 0)
63
+ * @returns {number}
64
+ */
65
+ get dayOfWeek(): Gregorian.DayOfWeek;
66
+ /**
67
+ * Returns a DateTime object for 00:00 of this date.
68
+ */
69
+ get date(): DateTime;
70
+ /**
71
+ * Returns the time of day represented by a ClockTime object.
72
+ * @returns {ClockTime}
73
+ */
74
+ get timeOfDay(): ClockTime;
75
+ /**
76
+ * Measures the difference between two dates as a TimeSpan.
77
+ * @param first
78
+ * @param last
79
+ */
80
+ static between(first: Date | DateTime, last: Date | DateTime): TimeSpan;
81
+ /**
82
+ * Calculates if the given year is a leap year using the formula:
83
+ * ((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0)
84
+ * @param year
85
+ * @returns {boolean}
86
+ */
87
+ static isLeapYear(year: number): boolean;
88
+ /**
89
+ * Returns the number of days for the specific year and month.
90
+ * @param year
91
+ * @param month
92
+ * @returns {any}
93
+ */
94
+ static daysInMonth(year: number, month: Gregorian.Month): number;
95
+ static from(calendarDate: CalendarDate): DateTime;
96
+ static from(year: number, month: Gregorian.Month, day: number): DateTime;
97
+ static fromCalendarDate(calendarDate: CalendarDate): DateTime;
98
+ static fromCalendarDate(year: number, month: number, day: number): DateTime;
99
+ toJsDate(): Date;
100
+ addMilliseconds(ms: number): DateTime;
101
+ addSeconds(seconds: number): DateTime;
102
+ addMinutes(minutes: number): DateTime;
103
+ addHours(hours: number): DateTime;
104
+ addDays(days: number): DateTime;
105
+ addMonths(months: number): DateTime;
106
+ addYears(years: number): DateTime;
107
+ /**
108
+ * Receives an TimeQuantity value and adds based on the total milliseconds.
109
+ * @param {TimeQuantity} time
110
+ * @returns {DateTime}
111
+ */
112
+ add(time: TimeQuantity): DateTime;
113
+ /**
114
+ * Receives an TimeQuantity value and subtracts based on the total milliseconds.
115
+ * @param {TimeQuantity} time
116
+ * @returns {DateTime}
117
+ */
118
+ subtract(time: TimeQuantity): DateTime;
119
+ /**
120
+ * Returns a TimeSpan representing the amount of time between two dates.
121
+ * @param previous
122
+ * @returns {TimeSpan}
123
+ */
124
+ timePassedSince(previous: Date | DateTime): TimeSpan;
125
+ /**
126
+ * Returns a readonly object which contains all the date and time components.
127
+ */
128
+ toTimeStamp(): TimeStamp;
129
+ /**
130
+ * Returns a UTC version of this date if its kind is local.
131
+ * @returns {DateTime}
132
+ */
133
+ toUniversalTime(): DateTime;
134
+ /**
135
+ * Compares a JS Date with the current instance. Does not evaluate the kind.
136
+ * @param other
137
+ * @returns {boolean}
138
+ */
139
+ equals(other: Date): boolean;
140
+ /**
141
+ * Compares another JsDateConvertible object and returns true if they or their value are equal.
142
+ * @param other The other JsDateConvertible object.
143
+ * @param strict When strict is true, the 'kind' also must match.
144
+ * @returns {boolean}
145
+ */
146
+ equals(other: JsDateConvertible, strict?: boolean): boolean;
147
+ compareTo(other: Date | JsDateConvertible): number;
148
+ /**
149
+ * Returns true if the value is the same UTC time.
150
+ * @param {Date | JsDateConvertible} other
151
+ * @return {boolean}
152
+ */
153
+ equivalent(other: Date | JsDateConvertible): boolean;
154
+ }