dmtrKovalenko / date-io

Abstraction over common javascript date management libraries
MIT License
726 stars 90 forks source link

New format date suggestion dd/mm/yyyy #672

Open arsen26 opened 4 hours ago

arsen26 commented 4 hours ago

Currently, component supports a variety of formats, but they lack native support for commonly used formats such as day/month/year (DD/MM/YYYY) , day/month/year hours:minutes (DD/MM/YYYY HH:MM) hours:minutes:seconds DD/MM/YYYY HH:MM:SS) format. Additionally, the format options section does not include a way to retrieve the month as a number, which limits flexibility when formatting dates.

These formats are widely used in many countries, particularly in Europe, and their absence creates extra work for developers who need to implement custom formatting logic. Including these formats and the ability to represent the month as a number would significantly enhance usability and streamline the development process for applications targeting these regions.

dmtrKovalenko commented 4 hours ago

We are specifically not exposing custom format dates as a a string or something like that because it is close to impossible to unify across the libraries but as well it is generally a bad practice because Americans may be confused when you use dd/mm/yyyy and Europeans will be confused by American date format vice versa

Instead, we expose the localized versions of the date format that abstract same input but in a more localized manner. So in your case, you should use

  keyboardDate: TLibFormatToken;
  /** Localized keyboard input friendly date/time format @example "02/13/2020 23:44" */
  keyboardDateTime: TLibFormatToken;

this will do the trick