TorstenDittmann / OmniaWrite

A text editor engineered for creative writing.
https://OmniaWrite.com
Apache License 2.0
162 stars 34 forks source link

Wrong datetime display #96

Closed dennistobar closed 3 years ago

dennistobar commented 4 years ago

Describe the bug Is a minor issue. With i18n, the displayed datetime is wrong localized. It shows MMMM Do YYYY, h:mm a. in Spanish it produces Septiembre 28° 2020 9:20 am.

To Reproduce Steps to reproduce the behavior:

  1. Change the language to Spanish
  2. Login with any account
  3. See the activity log

Expected behavior See a localized datetime: in Spanish should be "28 de septiembre de 2020 09:20 am" (maybe LLL in Moment js)

Screenshots Captura de pantalla de 2020-09-28 21-34-44

Desktop (please complete the following information):

TorstenDittmann commented 4 years ago

Since moment.js is officially "done" now and not being maintained anymore - this might be a good reason to look into an alternative.

I would love to go for the non dependency approach and use Intl from JavaScript, but this would limit the usage of displaying localized time past (10 seconds ago, 5 minutes ago, ...).

I might need to look into different libraries.

Thanks alot for your contribution!

dennistobar commented 4 years ago

Yes, I saw the same the past week on Reddit (yes, I'm read Reddit for some news!). The Momentjs devs suggest some libraries or "just raw Intl API". For the case "10 seconds ago" it's a bad idea use Intl, except if you will want to create a function to calculate (really bad idea).

In other project, I see date-fns as replacement and it was really cool.

TorstenDittmann commented 4 years ago

Yeah, I already had a headache just thinking about doing that with the Intl API 😅

date-fns really looks promising! Surprised I never heard of it...

dennistobar commented 4 years ago

Hi, I just write some lines to test the format times and how to use unixtimestamp in the code. See my test commit. Remember, I know enough TS/JS to read, but not to write fluently :)

TorstenDittmann commented 4 years ago

Can you create a test PR with that commit for a preview environment?

dennistobar commented 4 years ago

Done in #98

TorstenDittmann commented 3 years ago

@dennistobar I think it will be a good move to replace momentjs with date-fns 👍

I created an issue #99 if you are interested to work on it and give writing Javascript with Svelte a go ;-)

dennistobar commented 3 years ago

Nice to hear, I'll work on it :+1:

TorstenDittmann commented 3 years ago

Closed thanks to @dennistobar