Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,11 @@ export const TimestampPickerModal = ({ onClose, composer }: TimestampPickerProps
confirmDisabled={!isValid}
>
<Box display='flex' flexDirection='column'>
<Preview date={currentDate} format={currentFormat} timezone={currentTimezone} />
<Controller name='date' control={control} render={({ field }) => <DatePicker {...field} />} />
<Controller name='date' control={control} render={({ field }) => <TimePicker {...field} />} />
<Controller name='format' control={control} render={({ field }) => <FormatSelector {...field} />} />
<Controller name='timezone' control={control} render={({ field }) => <TimezoneSelector {...field} />} />
<Preview date={currentDate} format={currentFormat} timezone={currentTimezone} />
</Box>
</GenericModal>
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Box, Field, FieldLabel, FieldRow, Select } from '@rocket.chat/fuselage';
import { Box, Field, FieldHint, FieldDescription, FieldLabel, FieldRow, Select } from '@rocket.chat/fuselage';
import type { ReactElement, Key } from 'react';
import { useTranslation } from 'react-i18next';

Expand Down Expand Up @@ -26,9 +26,11 @@ const TimezoneSelector = ({ value, onChange }: TimezoneSelectorProps): ReactElem
<Box mb='x16'>
<Field>
<FieldLabel>{t('Timezone')}</FieldLabel>
<FieldDescription>{t('Timezone_picker_description')}</FieldDescription>
<FieldRow>
<Select value={value} onChange={handleTimezoneChange} options={options} width='full' />
</FieldRow>
<FieldHint>{t('Timezone_picker_hint')}</FieldHint>
</Field>
</Box>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,28 @@ exports[`Story Tests renders Default without crashing 1`] = `
<div
class="rcx-box rcx-box--full rcx-css-1tbw8nv"
>
<div
class="rcx-box rcx-box--full rcx-css-1bjg207"
>
<div
class="rcx-box rcx-box--full rcx-field"
>
<label
class="rcx-box rcx-box--full rcx-field__label rcx-label"
>
Preview
</label>
<span
class="rcx-box rcx-box--full rcx-field__row"
>
<div
data-testid="mock-gazzodown-text"
>
Mocked GazzodownText
</div>
</span>
</div>
</div>
<div
class="rcx-box rcx-box--full rcx-css-1bjg207"
>
Expand Down Expand Up @@ -274,6 +296,11 @@ exports[`Story Tests renders Default without crashing 1`] = `
>
Timezone
</label>
<span
class="rcx-box rcx-box--full rcx-field__description"
>
Timezone_picker_description
</span>
<span
class="rcx-box rcx-box--full rcx-field__row"
>
Expand Down Expand Up @@ -443,27 +470,10 @@ exports[`Story Tests renders Default without crashing 1`] = `
</i>
</button>
</span>
</div>
</div>
<div
class="rcx-box rcx-box--full rcx-css-1bjg207"
>
<div
class="rcx-box rcx-box--full rcx-field"
>
<label
class="rcx-box rcx-box--full rcx-field__label rcx-label"
>
Preview
</label>
<span
class="rcx-box rcx-box--full rcx-field__row"
class="rcx-box rcx-box--full rcx-field__hint"
>
<div
data-testid="mock-gazzodown-text"
>
Mocked GazzodownText
</div>
Timezone_picker_hint
</span>
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions apps/meteor/client/lib/utils/timestamp/formats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ export const TIMESTAMP_FORMATS: Record<TimestampFormat, ITimestampFormatConfig>
},
f: {
label: 'timestamps.fullDateTime',
format: 'PPPppp',
format: 'PPPP p',
description: 'timestamps.fullDateTimeDescription',
},
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
F: {
label: 'timestamps.fullDateTimeLong',
format: 'PPPPpppp',
format: 'PPPP pp',
description: 'timestamps.fullDateTimeLongDescription',
},
R: {
Expand Down
4 changes: 2 additions & 2 deletions packages/gazzodown/src/elements/Timestamp/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ const ShortDate = ({ value }: { value: Date }) => <Time value={format(value, 'P'
const LongDate = ({ value }: { value: Date }) => <Time value={format(value, 'Pp')} dateTime={value.toISOString()} />;

// eslint-disable-next-line react/no-multi-comp
const FullDate = ({ value }: { value: Date }) => <Time value={format(value, 'PPPppp')} dateTime={value.toISOString()} />;
const FullDate = ({ value }: { value: Date }) => <Time value={format(value, 'PPPP p')} dateTime={value.toISOString()} />;

// eslint-disable-next-line react/no-multi-comp
const FullDateLong = ({ value }: { value: Date }) => <Time value={format(value, 'PPPPpppp')} dateTime={value.toISOString()} />;
const FullDateLong = ({ value }: { value: Date }) => <Time value={format(value, 'PPPP pp')} dateTime={value.toISOString()} />;

// eslint-disable-next-line react/no-multi-comp
const Time = ({ value, dateTime }: { value: string; dateTime: string }) => (
Expand Down
14 changes: 8 additions & 6 deletions packages/i18n/src/locales/en.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -5368,7 +5368,9 @@
"Timeout_in_miliseconds_hint": "The time in milliseconds to wait for an external service to respond before canceling the request.",
"Timeouts": "Timeouts",
"Timestamp": "Timestamp",
"Timezone": "Timezone",
"Timezone": "Time zone",
"Timezone_picker_description": "Select time zone of entered time",
"Timezone_picker_hint": "Others see timestamps converted to their own timezone.",
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
"Title": "Title",
"Title_bar_color": "Title bar color",
"Title_bar_color_offline": "Title bar color offline",
Expand Down Expand Up @@ -7194,15 +7196,15 @@
"timestamps.shortTime": "Short time",
"timestamps.longTime": "Long time",
"timestamps.shortDate": "Short date",
"timestamps.longDate": "Long date",
"timestamps.fullDateTime": "Full date and time",
"timestamps.fullDateTimeLong": "Full date and time (long)",
"timestamps.relativeTime": "Relative time",
"timestamps.longDate": "Short date and time",
"timestamps.fullDateTime": "Full date and short time",
"timestamps.fullDateTimeLong": "Full date and long time",
"timestamps.relativeTime": "Relative",
"timestamps.shortTimeDescription": "12:00 AM",
"timestamps.longTimeDescription": "12:00:00 AM",
"timestamps.shortDateDescription": "12/31/2020",
"timestamps.longDateDescription": "12/31/2020, 12:00 AM",
"timestamps.fullDateTimeDescription": "December 31, 2020 12:00 AM",
"timestamps.fullDateTimeDescription": "Thursday, December 31, 2020 12:00 AM",
"timestamps.fullDateTimeLongDescription": "Thursday, December 31, 2020 12:00:00 AM",
"__username__profile_picture": "{{username}}'s profile picture",
"User_card": "User card",
Expand Down
Loading