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

Get rid of dayjs from @gravity-ui/date-utils #23

Open
hozblok opened this issue Oct 31, 2024 · 3 comments
Open

Get rid of dayjs from @gravity-ui/date-utils #23

hozblok opened this issue Oct 31, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@hozblok
Copy link

hozblok commented Oct 31, 2024

Objective

The part of work to remove the dependency of dayjs has already been done. The part related to i18n remains.

Solution Proposal

  1. Create concept to implement new i18n model.
  2. Get rid of i18n with dayjs
  3. Remove dayjs.
  4. Simplify the library by removing singletonism.
@korvin89
Copy link

сс @ValeraS

@arteria32
Copy link

Objective

The part of work to remove the dependency of dayjs has already been done. The part related to i18n remains.

Solution Proposal

  1. Create concept to implement new i18n model.
  2. Get rid of i18n with dayjs
  3. Remove dayjs.
  4. Simplify the library by removing singletonism.

Note:
I think you miss a one step (mb, first step): implement a method to decode timestamp from string.

In this method dayjs.locale need only to getting preset of locale aware formats:

Steps of algorithm

  1. In date-utils apply a plugin customParseFormat
  2. Call a function to parse string with specific format
  3. Make a parser by input format string and locale settings
  4. Check a locale aware format in locale dictionary

cc:@hozblok

@arteria32
Copy link

arteria32 commented Nov 6, 2024

What do you think about using Intl.DateTimeFormat and Intl.RelativeTimeFormat instead of dayjs.locale? It is an embedded ECMAScript internationalization API.
In comparison to a full rewrite of dayjs.locale, using an embedded tool can reduce the cost of implementation and support.

сс: @ValeraS, @korvin89

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: No status
Development

No branches or pull requests

3 participants