adobe / adobe/react-spectrum

Allow dateFields to have different formats

Open
#6,266 8 comments 15 reactions 0 assignees View on GitHub
DatePicker enhancement
Dominant language
TypeScript
Stars
15.9k
Forks
1.6k
Avg merge
3d 9m
Merged PRs (30d)
59

Description

### Provide a general summary of the feature here

Our users are from multiple countries around the world but when they are travelling and work on different locations, there are some "issues" with how the date-inputs are formatted due to the locale on their temporary machines (if not on laptops). A request was made that the input format should be possible to customize to have the literal months rather than numerical.

### 🤔 Expected Behavior?

I would expect something like this:

```tsx
const formatter = useDateFormatter({ month: 'short', year: 'numeric', day: '2-digit' })
const state = useDateFieldState({...props, formatter})
```

which would result in an input looking something like this:
![image](https://github.com/adobe/react-spectrum/assets/11261560/64598fea-ebcd-47fd-afe2-cddcc25c7521)

### 😯 Current Behavior

The format is always numerical based on the default locale:
![image](https://github.com/adobe/react-spectrum/assets/11261560/1e3a18fc-599d-449a-b4c2-75e02bc9ac09)

### 💁 Possible Solution

_No response_

### 🔦 Context

Make it easier to have human-readable dates, without the users having to wonder if 03/05/2024 means the 3rd of May or the 5th of March, depending on which computer they are currently working from.

### 💻 Examples

_No response_

### 🧢 Your Company/Team

_No response_

### 🕷 Tracking Issue

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.