Skip to content

Replace date-fns's formatDate with Intl.DateTimeFormat #136

@techniq

Description

@techniq

Similar to the recent work to use Intl.NumberFormat instead of d3-format for formatNumber(), it would be great use Intl.DateTimeFormat instead of date-fns's format for formatDate

  • Add internationalization support
  • Add settings() support
  • Support existing PeriodType and variant (short/long)
  • Evaluate existing date-fns format() usage (sometimes aliased as dateFormat or formatDate) and possibly replace. Might be difficult as these usually allow passing date format strings)

One day we might be able to replace date-fns with Temporal. There is a polyfill but not sure it's worth investigating yet.

After formatting, there are a lot of date components (DateField, DatePickerField, DateRangeField, ... ) that would need updated for Intl support (maybe we just allow a global date format string (ex. MM/dd/yyyy) in settings() that we use for these types of use cases.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions