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

dnm: fix incorrect date/time order in rtl #7353

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
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
4 changes: 2 additions & 2 deletions packages/@react-spectrum/datepicker/src/DatePickerField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export function DatePickerField<T extends DateValue>(props: DatePickerFieldProps
let {fieldProps, inputProps} = useDateField({...props, inputRef}, state, ref);

return (
<div {...fieldProps} data-testid={props['data-testid']} className={classNames(datepickerStyles, 'react-spectrum-Datepicker-segments', inputClassName)} ref={ref}>
<span {...fieldProps} data-testid={props['data-testid']} className={classNames(datepickerStyles, 'react-spectrum-Datepicker-segments', inputClassName)} ref={ref}>
{state.segments.map((segment, i) =>
(<DatePickerSegment
key={i}
Expand All @@ -56,6 +56,6 @@ export function DatePickerField<T extends DateValue>(props: DatePickerFieldProps
isRequired={isRequired} />)
)}
<input {...inputProps} ref={inputRef} />
</div>
</span>
);
}
4 changes: 2 additions & 2 deletions packages/@react-spectrum/datepicker/src/DatePickerSegment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ function EditableSegment({segment, state}: DatePickerSegmentProps) {
let {segmentProps} = useDateSegment(segment, state, ref);

return (
<div
<span
{...segmentProps}
ref={ref}
className={classNames(styles, 'react-spectrum-DatePicker-cell', {
Expand All @@ -64,6 +64,6 @@ function EditableSegment({segment, state}: DatePickerSegmentProps) {
style={segmentProps.style}
data-testid={segment.type}>
{segment.isPlaceholder ? <span aria-hidden="true" className={classNames(styles, 'react-spectrum-DatePicker-placeholder')}>{segment.placeholder}</span> : segment.text}
</div>
</span>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ function DateRangePicker<T extends DateValue>(props: SpectrumDateRangePickerProp

function DateRangeDash() {
return (
<div
<span
aria-hidden="true"
data-testid="date-range-dash"
className={classNames(datepickerStyles, 'react-spectrum-Datepicker-rangeDash')} />
Expand Down
7 changes: 4 additions & 3 deletions packages/@react-spectrum/datepicker/src/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
}

.react-spectrum-Datepicker-inputContents {
display: flex;
display: block;
align-items: center;
height: 100%;
overflow-x: auto;
Expand All @@ -77,7 +77,7 @@
}

.react-spectrum-Datepicker-inputSized {
display: flex;
display: block;
height: 100%;
align-items: center;
}
Expand All @@ -89,7 +89,7 @@
}

.react-spectrum-Datepicker-segments {
display: flex;
display: inline;
align-items: center;
}

Expand All @@ -100,6 +100,7 @@
}

.react-spectrum-DatePicker-cell {
display: inline;
border: none;
background: none;
padding: 0 2px;
Expand Down
2 changes: 2 additions & 0 deletions packages/react-aria-components/docs/TimeField.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -268,9 +268,11 @@ In most cases, your data will come from and be sent to a server as an [ISO 8601]
```tsx example
import {parseZonedDateTime} from '@internationalized/date';

<div lang="he-IL" dir="rtl">
<MyTimeField
label="Event time"
defaultValue={parseZonedDateTime('2022-11-07T00:45[America/Los_Angeles]')} />
</div>
```

`TimeField` displays times in the time zone included in the `ZonedDateTime` object. The above example is always displayed in Pacific Standard Time because the `America/Los_Angeles` time zone identifier is provided. [@internationalized/date](../internationalized/date/) includes functions for converting dates between time zones, or parsing a date directly into a specific time zone or the user's local time zone, as shown below.
Expand Down
Loading