-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Datetimepicker typecheck #244
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -148,10 +148,13 @@ export const RolloutAndTiming: React.FC<{ | |||||||||||||||||||||||
onChange={(t) => { | ||||||||||||||||||||||||
onChange({ | ||||||||||||||||||||||||
...value, | ||||||||||||||||||||||||
startTime: t.toDate( | ||||||||||||||||||||||||
Intl.DateTimeFormat().resolvedOptions() | ||||||||||||||||||||||||
.timeZone, | ||||||||||||||||||||||||
), | ||||||||||||||||||||||||
startTime: | ||||||||||||||||||||||||
t != null | ||||||||||||||||||||||||
? t.toDate( | ||||||||||||||||||||||||
Intl.DateTimeFormat().resolvedOptions() | ||||||||||||||||||||||||
.timeZone, | ||||||||||||||||||||||||
) | ||||||||||||||||||||||||
: new Date(), | ||||||||||||||||||||||||
}); | ||||||||||||||||||||||||
}} | ||||||||||||||||||||||||
/>{" "} | ||||||||||||||||||||||||
|
@@ -161,10 +164,13 @@ export const RolloutAndTiming: React.FC<{ | |||||||||||||||||||||||
onChange={(t) => { | ||||||||||||||||||||||||
onChange({ | ||||||||||||||||||||||||
...value, | ||||||||||||||||||||||||
endTime: t.toDate( | ||||||||||||||||||||||||
Intl.DateTimeFormat().resolvedOptions() | ||||||||||||||||||||||||
.timeZone, | ||||||||||||||||||||||||
), | ||||||||||||||||||||||||
endTime: | ||||||||||||||||||||||||
t != null | ||||||||||||||||||||||||
? t.toDate( | ||||||||||||||||||||||||
Intl.DateTimeFormat().resolvedOptions() | ||||||||||||||||||||||||
.timeZone, | ||||||||||||||||||||||||
) | ||||||||||||||||||||||||
: new Date(), | ||||||||||||||||||||||||
Comment on lines
+167
to
+173
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Apply consistent handling for endTime Apply the same improvement as suggested for startTime to maintain consistency. - endTime:
- t != null
- ? t.toDate(
- Intl.DateTimeFormat().resolvedOptions()
- .timeZone,
- )
- : new Date(),
+ endTime: t?.toDate(
+ Intl.DateTimeFormat().resolvedOptions()
+ .timeZone,
+ ) ?? value.endTime, 📝 Committable suggestion
Suggested change
|
||||||||||||||||||||||||
}); | ||||||||||||||||||||||||
}} | ||||||||||||||||||||||||
aria-label="End Time" | ||||||||||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Reconsider the default fallback for null dates
While the null check is good, defaulting to the current date when
t
is null might mask errors or create unexpected behavior. Consider either:📝 Committable suggestion