usememos / memos

An open source, lightweight note-taking service. Easily capture and share your great thoughts.
https://usememos.com
MIT License
30.29k stars 2.27k forks source link

Allow memo date change Firefox / Safari #3812

Open RoccoSmit opened 1 month ago

RoccoSmit commented 1 month ago

Describe the bug

in v0.22.4 the ability to update memo dates was reinstated. This feature works in Edge and Chrome but not Firefox or Safari

For Firefox this is due to needing a specific date string format provided as the datetime-local typed input value otherwise the time section of the datetime view is not populated. (Chromium based browsers don't have this issue because you can set the time on their calendar view, but you cant do this in Firefox of Safari)

This becomes an issue as Firefox only fires the change event needed to update the date time state if the complete date and time is set on the input

I dont have access to a Mac to debug and confirm this is the same reason for Safari not working, but a quick test showed Safari sets the date to undefined

POC to test this behaviour https://jsfiddle.net/95c2zae1/3/

Date format used when featured worked in v0.22.2 https://github.com/usememos/memos/blob/e4a09c407c6e2099462c0388e1441781829ad4b8/web/src/hooks/useDateTime.ts#L9

Date format used in v0.22.4 https://github.com/usememos/memos/blob/a94855516611ae56ff2ca9db9816866c3d18ab11/web/src/components/MemoEditor/index.tsx#L421

I've created a PR that will address fixing the date format https://github.com/usememos/memos/pull/3783

Steps to reproduce

1 -> Create memo using Firefox/Safari 2 -> Edit memo -> change date 3 -> date does not update on UI

The version of Memos you're using.

v0.22.4

Screenshots or additional context

No response

RoccoSmit commented 3 weeks ago

Bump

30/08 Discord question re the issue https://discord.com/channels/1017113925776588902/1045138348165050409/1278800934012719104

ilteoood commented 1 week ago

Actually, on Chrome for Android is not working either

lcfd commented 16 hours ago

I can confirm that by editing a memo's date on Safari it will show Invalid instead of the picked date. If I save the post the app sets automatically the date to 1 January 1970.