Skip to content

Commit

Permalink
fix(client): 🐛 fix mui rendering of utc dates
Browse files Browse the repository at this point in the history
  • Loading branch information
AmruthPillai committed Jul 30, 2022
1 parent 5197f95 commit 977fa72
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion client/components/shared/ResumeInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ const ResumeInput: React.FC<Props> = ({ type = 'text', label, path, className, m
renderInput={(params) => <TextField {...params} error={false} className={className} />}
onChange={(date: Date | null, keyboardInputValue: string | undefined) => {
isEmpty(keyboardInputValue) && onChangeValue('');
date && dayjs(date).utc().isValid() && onChangeValue(date.toISOString());
date && dayjs(date).utc().isValid() && onChangeValue(dayjs(date).utc().toISOString());
}}
/>
);
Expand Down
2 changes: 1 addition & 1 deletion client/modals/builder/sections/AwardModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ const AwardModal: React.FC = () => {
views={['year', 'month', 'day']}
onChange={(date: Date | null, keyboardInputValue: string | undefined) => {
isEmpty(keyboardInputValue) && field.onChange('');
date && dayjs(date).utc().isValid() && field.onChange(date.toISOString());
date && dayjs(date).utc().isValid() && field.onChange(dayjs(date).utc().toISOString());
}}
renderInput={(params) => (
<TextField
Expand Down
2 changes: 1 addition & 1 deletion client/modals/builder/sections/CertificateModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ const CertificateModal: React.FC = () => {
views={['year', 'month', 'day']}
onChange={(date: Date | null, keyboardInputValue: string | undefined) => {
isEmpty(keyboardInputValue) && field.onChange('');
date && dayjs(date).utc().isValid() && field.onChange(date.toISOString());
date && dayjs(date).utc().isValid() && field.onChange(dayjs(date).utc().toISOString());
}}
renderInput={(params) => (
<TextField
Expand Down
4 changes: 2 additions & 2 deletions client/modals/builder/sections/CustomModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ const CustomModal: React.FC = () => {
views={['year', 'month', 'day']}
onChange={(date: Date | null, keyboardInputValue: string | undefined) => {
isEmpty(keyboardInputValue) && field.onChange('');
date && dayjs(date).utc().isValid() && field.onChange(date.toISOString());
date && dayjs(date).utc().isValid() && field.onChange(dayjs(date).utc().toISOString());
}}
renderInput={(params) => (
<TextField
Expand All @@ -174,7 +174,7 @@ const CustomModal: React.FC = () => {
views={['year', 'month', 'day']}
onChange={(date: Date | null, keyboardInputValue: string | undefined) => {
isEmpty(keyboardInputValue) && field.onChange('');
date && dayjs(date).utc().isValid() && field.onChange(date.toISOString());
date && dayjs(date).utc().isValid() && field.onChange(dayjs(date).utc().toISOString());
}}
renderInput={(params) => (
<TextField
Expand Down
4 changes: 2 additions & 2 deletions client/modals/builder/sections/EducationModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ const EducationModal: React.FC = () => {
views={['year', 'month', 'day']}
onChange={(date: Date | null, keyboardInputValue: string | undefined) => {
isEmpty(keyboardInputValue) && field.onChange('');
date && dayjs(date).utc().isValid() && field.onChange(date.toISOString());
date && dayjs(date).utc().isValid() && field.onChange(dayjs(date).utc().toISOString());
}}
renderInput={(params) => (
<TextField
Expand All @@ -197,7 +197,7 @@ const EducationModal: React.FC = () => {
views={['year', 'month', 'day']}
onChange={(date: Date | null, keyboardInputValue: string | undefined) => {
isEmpty(keyboardInputValue) && field.onChange('');
date && dayjs(date).utc().isValid() && field.onChange(date.toISOString());
date && dayjs(date).utc().isValid() && field.onChange(dayjs(date).utc().toISOString());
}}
renderInput={(params) => (
<TextField
Expand Down
4 changes: 2 additions & 2 deletions client/modals/builder/sections/ProjectModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ const ProjectModal: React.FC = () => {
views={['year', 'month', 'day']}
onChange={(date: Date | null, keyboardInputValue: string | undefined) => {
isEmpty(keyboardInputValue) && field.onChange('');
date && dayjs(date).utc().isValid() && field.onChange(date.toISOString());
date && dayjs(date).utc().isValid() && field.onChange(dayjs(date).utc().toISOString());
}}
renderInput={(params) => (
<TextField
Expand All @@ -167,7 +167,7 @@ const ProjectModal: React.FC = () => {
views={['year', 'month', 'day']}
onChange={(date: Date | null, keyboardInputValue: string | undefined) => {
isEmpty(keyboardInputValue) && field.onChange('');
date && dayjs(date).utc().isValid() && field.onChange(date.toISOString());
date && dayjs(date).utc().isValid() && field.onChange(dayjs(date).utc().toISOString());
}}
renderInput={(params) => (
<TextField
Expand Down
2 changes: 1 addition & 1 deletion client/modals/builder/sections/PublicationModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ const PublicationModal: React.FC = () => {
views={['year', 'month', 'day']}
onChange={(date: Date | null, keyboardInputValue: string | undefined) => {
isEmpty(keyboardInputValue) && field.onChange('');
date && dayjs(date).utc().isValid() && field.onChange(date.toISOString());
date && dayjs(date).utc().isValid() && field.onChange(dayjs(date).utc().toISOString());
}}
renderInput={(params) => (
<TextField
Expand Down
4 changes: 2 additions & 2 deletions client/modals/builder/sections/VolunteerModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ const VolunteerModal: React.FC = () => {
views={['year', 'month', 'day']}
onChange={(date: Date | null, keyboardInputValue: string | undefined) => {
isEmpty(keyboardInputValue) && field.onChange('');
date && dayjs(date).utc().isValid() && field.onChange(date.toISOString());
date && dayjs(date).utc().isValid() && field.onChange(dayjs(date).utc().toISOString());
}}
renderInput={(params) => (
<TextField
Expand All @@ -164,7 +164,7 @@ const VolunteerModal: React.FC = () => {
views={['year', 'month', 'day']}
onChange={(date: Date | null, keyboardInputValue: string | undefined) => {
isEmpty(keyboardInputValue) && field.onChange('');
date && dayjs(date).utc().isValid() && field.onChange(date.toISOString());
date && dayjs(date).utc().isValid() && field.onChange(dayjs(date).utc().toISOString());
}}
renderInput={(params) => (
<TextField
Expand Down
4 changes: 2 additions & 2 deletions client/modals/builder/sections/WorkModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ const WorkModal: React.FC = () => {
views={['year', 'month', 'day']}
onChange={(date: Date | null, keyboardInputValue: string | undefined) => {
isEmpty(keyboardInputValue) && field.onChange('');
date && dayjs(date).utc().isValid() && field.onChange(date.toISOString());
date && dayjs(date).utc().isValid() && field.onChange(dayjs(date).utc().toISOString());
}}
renderInput={(params) => (
<TextField
Expand All @@ -164,7 +164,7 @@ const WorkModal: React.FC = () => {
views={['year', 'month', 'day']}
onChange={(date: Date | null, keyboardInputValue: string | undefined) => {
isEmpty(keyboardInputValue) && field.onChange('');
date && dayjs(date).utc().isValid() && field.onChange(date.toISOString());
date && dayjs(date).utc().isValid() && field.onChange(dayjs(date).utc().toISOString());
}}
renderInput={(params) => (
<TextField
Expand Down

0 comments on commit 977fa72

Please sign in to comment.