HermanMartinus / bearblog

Free, no-nonsense, super fast blogging.
MIT License
2.36k stars 73 forks source link

Populate timezone from client instead of server #276

Closed jsjoeio closed 1 month ago

jsjoeio commented 3 months ago

Bug

When I leave out published_date from the metadata and then hit publish, the server populates it using it's own timezone.

Steps to Reproduce

  1. create blog post around 8:55PM Arizona
  2. hit publish

Expected

published_date should show same date as user's local timezone (browser)

Actual

it uses the server timezone which will show a day in the future.

Suggestion

Calculate the date on the client using the timezone set in the browser, include in request and use on server

dotmanner commented 1 month ago

I am a user of Bear Blog in South Korea. In my case, new posts are published with yesterday's date. I hope there is a solution for this.

HermanMartinus commented 1 month ago

I've just pushed an update that shows you your local timezone in your post editor. Under the hood everything is stored in UTC. In the editor a script updates published_date value to show your local datetime.

I have yet to implement it to show local timezones on the blogs themselves (which I'll get to).

I hope this leads to less confusion when posting :)

HermanMartinus commented 1 month ago

Times are now shown universally at local time

jsjoeio commented 1 month ago

Hooray! You rock Herman, thanks so much :D

dotmanner commented 1 month ago

Wow! Thank you so much, Herman. 👍