Skip to content

Commit 19d429a

Browse files
committed
Upgrade Luxon & handle min/max type change
Also fix the case of empty input/output trying to be cast
1 parent 8d6a5f9 commit 19d429a

File tree

3 files changed

+22
-11
lines changed

3 files changed

+22
-11
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@
125125
"@types/jest": "^29.5.7",
126126
"@types/jsonwebtoken": "^9.0.4",
127127
"@types/lodash": "^4.14.200",
128-
"@types/luxon": "^3.4.2",
128+
"@types/luxon": "^3.6.2",
129129
"@types/node": "^22.7.8",
130130
"@types/prismjs": "^1.26.2",
131131
"@types/react": "^18.2.33",

src/common/temporal/calendar-date.ts

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
import { setInspectOnClass, setToStringTag } from '@seedcompany/common';
1+
import {
2+
type NonEmptyArray,
3+
setInspectOnClass,
4+
setToStringTag,
5+
} from '@seedcompany/common';
26
import {
37
DateObjectUnits,
48
DateTime,
@@ -160,13 +164,19 @@ export class CalendarDate<IsValid extends boolean = DefaultValidity>
160164
static max(): undefined;
161165
static max(...dateTimes: DateTime[]): CalendarDate;
162166
static max(...dateTimes: DateTime[]): CalendarDate | undefined {
163-
return CalendarDate.fromDateTime(super.max(...dateTimes));
167+
if (dateTimes.length === 0) return undefined;
168+
return CalendarDate.fromDateTime(
169+
super.max(...(dateTimes as unknown as NonEmptyArray<DateTime>)),
170+
);
164171
}
165172

166173
static min(): undefined;
167174
static min(...dateTimes: DateTime[]): CalendarDate;
168175
static min(...dateTimes: DateTime[]): CalendarDate | undefined {
169-
return CalendarDate.fromDateTime(super.min(...dateTimes));
176+
if (dateTimes.length === 0) return undefined;
177+
return CalendarDate.fromDateTime(
178+
super.min(...(dateTimes as unknown as NonEmptyArray<DateTime>)),
179+
);
170180
}
171181

172182
static utc(

yarn.lock

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4114,9 +4114,9 @@ __metadata:
41144114
linkType: hard
41154115

41164116
"@types/luxon@npm:^3.2.0, @types/luxon@npm:^3.4.2":
4117-
version: 3.4.2
4118-
resolution: "@types/luxon@npm:3.4.2"
4119-
checksum: 10c0/d835467de3daf7e17ba78b50bb5a14efd94272439ca067990d71332a54b311544459c69623eddd243b511b28d70194c9591a9ee8cf9c038962c965f991affd7e
4117+
version: 3.6.2
4118+
resolution: "@types/luxon@npm:3.6.2"
4119+
checksum: 10c0/7572ee52b3d3e9dd10464b90561a728b90f34b9a257751cc3ce23762693dd1d14fa98b7f103e2efe2c6f49033331f91de5681ffd65cca88618cefe555be326db
41204120
languageName: node
41214121
linkType: hard
41224122

@@ -5838,7 +5838,7 @@ __metadata:
58385838
"@types/jest": "npm:^29.5.7"
58395839
"@types/jsonwebtoken": "npm:^9.0.4"
58405840
"@types/lodash": "npm:^4.14.200"
5841-
"@types/luxon": "npm:^3.4.2"
5841+
"@types/luxon": "npm:^3.6.2"
58425842
"@types/node": "npm:^22.7.8"
58435843
"@types/prismjs": "npm:^1.26.2"
58445844
"@types/react": "npm:^18.2.33"
@@ -5916,6 +5916,7 @@ __metadata:
59165916
typescript-transform-paths: "npm:^3.4.6"
59175917
urlpattern-polyfill: "npm:^10.0.0"
59185918
uuid: "npm:^10.0.0"
5919+
validator: "npm:^13.15.0"
59195920
winston: "npm:^3.11.0"
59205921
xlsx: "https://cdn.sheetjs.com/xlsx-0.20.0/xlsx-0.20.0.tgz"
59215922
xregexp: "npm:^5.1.1"
@@ -9975,9 +9976,9 @@ __metadata:
99759976
linkType: hard
99769977

99779978
"luxon@npm:^3.3.0, luxon@npm:^3.5.0":
9978-
version: 3.5.0
9979-
resolution: "luxon@npm:3.5.0"
9980-
checksum: 10c0/335789bba95077db831ef99894edadeb23023b3eb2137a1b56acd0d290082b691cf793143d69e30bc069ec95f0b49f36419f48e951c68014f19ffe12045e3494
9979+
version: 3.6.1
9980+
resolution: "luxon@npm:3.6.1"
9981+
checksum: 10c0/906d57a9dc4d1de9383f2e9223e378c298607c1b4d17b6657b836a3cd120feb1c1de3b5d06d846a3417e1ca764de8476e8c23b3cd4083b5cdb870adcb06a99d5
99819982
languageName: node
99829983
linkType: hard
99839984

0 commit comments

Comments
 (0)