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

feat: custom job timeline date format #745

Merged
merged 2 commits into from
May 23, 2024

Conversation

HitomaruKonpaku
Copy link
Contributor

#743

  • New config dateFormats in UIConfig
    • short : When timestamp is in same day (today)
    • common : When timestamp is in same year
    • full

Seem like Timeline is the only place that have date/time format, I didn't check other page/component

@felixmosh
Copy link
Owner

In my opinion this field should be inside locale field, WDYT?

@HitomaruKonpaku
Copy link
Contributor Author

In my opinion this field should be inside locale field, WDYT?

Hmm I'm not really sure about that.

Will follow your call, but imo it isn't really related to locale since it will now follow the provided format without locale info

@felixmosh
Copy link
Owner

It is a locale matter, like language (the lng property), no?

@HitomaruKonpaku
Copy link
Contributor Author

I think it is more of a standard (like ISO 8601) 🤔

Anyway, do you wish to move it into locale ? 😄

@felixmosh
Copy link
Owner

I'm consulting with you 😄

You convinced me, I will review it soon.
Thank you for the PR

@felixmosh
Copy link
Owner

felixmosh commented May 19, 2024

I've reviewed the PR. I don't like the fact that you are using dateFns.format. can we make some map from strings to Intl config?
Maybe expose the entire Intl options

@HitomaruKonpaku
Copy link
Contributor Author

HitomaruKonpaku commented May 19, 2024

The thing with Intl.DateTimeFormat is that you can not specify exact format (or maybe I don't know how, please help me on this)

Like with this options (Intl.DateTimeFormat(locale, options)), based on locale config of the app (en-US)

  • The result will be 05/18/2024, 04:47:24
  • If I try to have locale = ja, it will be 2024/05/18 04:47:24
  • But the format I expected is 2024-05-18 04:47:24
    {
      year: 'numeric',
      month: '2-digit',
      day: '2-digit',
      hour: '2-digit',
      minute: '2-digit',
      second: '2-digit',
      hour12: false,
    }

@felixmosh
Copy link
Owner

Hi, maybe the undefined option here will help you?

console.log(event.toLocaleDateString(undefined, options));
// expected output (varies according to local timezone and default locale): Thursday, December 20, 2012

taken from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleDateString

@HitomaruKonpaku
Copy link
Contributor Author

Hi there @felixmosh

This is the result I got

image

@felixmosh felixmosh merged commit 41a1aad into felixmosh:master May 23, 2024
@felixmosh
Copy link
Owner

Ok, I see that it doesn't solves your issue.
I will approve it, and will refactor the it a bit, thank you 🙏

@felixmosh
Copy link
Owner

Released in v5.18.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants