Skip to content

Commit

Permalink
Date and datetime field timezone fixes (#2680)
Browse files Browse the repository at this point in the history
Makes sure that the UI renders the correct date regardless of the
timezone for the date and date time fields
  • Loading branch information
finnar-bin authored Apr 16, 2024
1 parent c566998 commit 465efe0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -912,7 +912,7 @@ export const Field = ({
<FieldTypeDate
name={name}
required={required}
value={value ? new Date(value) : null}
value={value ? moment(value).toDate() : null}
// format="MMM dd, yyyy"
onChange={(date) => onDateChange(date, name, datatype)}
error={errors && Object.values(errors)?.some((error) => !!error)}
Expand Down
2 changes: 1 addition & 1 deletion src/shell/components/FieldTypeDateTime/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export const FieldTypeDateTime = ({
<FieldTypeDate
name={name}
required={required}
value={dateString ? new Date(dateString) : null}
value={dateString ? moment(dateString).toDate() : null}
onChange={(date) => {
if (date) {
onChange(
Expand Down

0 comments on commit 465efe0

Please sign in to comment.