Skip to content
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

Making the timezone of the picker more clear to users #829

Merged
merged 2 commits into from
Nov 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions src/components/shared/pickers/DateTimePickerCTA.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ import { StaticDateTimePicker } from '@mui/x-date-pickers';
import { formatRFC3339 } from 'date-fns';
import { Calendar } from 'iconoir-react';
import { useMemo } from 'react';
import { BaseComponentProps } from 'types';
import { Typography } from '@mui/material';
import { FormattedMessage } from 'react-intl';
import { INVALID_DATE, TIMEZONE_OFFSET_REPLACEMENT } from './shared';
import { PickerProps } from './types';
import DateOrTimePickerWrapper from './DateOrTimePickerWrapper';
Expand All @@ -23,6 +26,24 @@ const formatDate = (formatValue: Date) => {
}
};

function PaperContent({ children }: BaseComponentProps) {
return (
<>
{children}
<Typography
sx={{
textAlign: 'right',
marginRight: 2,
marginBottom: 1,
}}
variant="caption"
>
<FormattedMessage id="dateTimePicker.picker.footer" />
</Typography>
</>
);
}

// TODO (date time picker) weird date formatting issue
// If the user types in a short value (that can be parsed as a date. ex: "1", "12", etc.) If they open the date picker
// and then select the same date that was parsed no change event is fired. This is a weird edge case so not
Expand Down Expand Up @@ -62,6 +83,9 @@ function DateTimePickerCTA(props: PickerProps) {
inputFormat="YYYY-mm-ddTHH:mm:ssZ"
openTo="day"
value={cleanedValue}
components={{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be a single line if the comma was removed.

PaperContent,
}}
onAccept={state.close}
onChange={(
onChangeValue: any,
Expand Down
1 change: 1 addition & 0 deletions src/lang/en-US.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1144,6 +1144,7 @@ const NewTransform: ResolvedIntlConfig['messages'] = {
const CustomRenderers: ResolvedIntlConfig['messages'] = {
'oauth.error.credentialsMissing': `need to complete OAuth`,
'dateTimePicker.button.ariaLabel': `Open date time picker for {label}`,
'dateTimePicker.picker.footer': `Timezone: UTC`,
'datePicker.button.ariaLabel': `Open date picker for {label}`,
'timePicker.button.ariaLabel': `Open time picker for {label}`,
};
Expand Down