@naturalcycles/js-lib 14.99.2 → 14.99.3
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.
|
@@ -96,7 +96,7 @@ class LocalTime {
|
|
|
96
96
|
return new LocalTime(new Date());
|
|
97
97
|
}
|
|
98
98
|
static fromComponents(c) {
|
|
99
|
-
return new LocalTime(new Date(c.year, c.month - 1, c.day, c.hour, c.minute, c.second));
|
|
99
|
+
return new LocalTime(new Date(c.year, c.month - 1, c.day || 1, c.hour || 0, c.minute || 0, c.second || 0));
|
|
100
100
|
}
|
|
101
101
|
get(unit) {
|
|
102
102
|
if (unit === 'year') {
|
|
@@ -93,7 +93,7 @@ export class LocalTime {
|
|
|
93
93
|
return new LocalTime(new Date());
|
|
94
94
|
}
|
|
95
95
|
static fromComponents(c) {
|
|
96
|
-
return new LocalTime(new Date(c.year, c.month - 1, c.day, c.hour, c.minute, c.second));
|
|
96
|
+
return new LocalTime(new Date(c.year, c.month - 1, c.day || 1, c.hour || 0, c.minute || 0, c.second || 0));
|
|
97
97
|
}
|
|
98
98
|
get(unit) {
|
|
99
99
|
if (unit === 'year') {
|
package/package.json
CHANGED
|
@@ -123,7 +123,9 @@ export class LocalTime {
|
|
|
123
123
|
static fromComponents(
|
|
124
124
|
c: { year: number; month: number } & Partial<LocalTimeComponents>,
|
|
125
125
|
): LocalTime {
|
|
126
|
-
return new LocalTime(
|
|
126
|
+
return new LocalTime(
|
|
127
|
+
new Date(c.year, c.month - 1, c.day || 1, c.hour || 0, c.minute || 0, c.second || 0),
|
|
128
|
+
)
|
|
127
129
|
}
|
|
128
130
|
|
|
129
131
|
get(unit: LocalTimeUnit): number {
|