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

Feature - Local Timezones #81

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

jbutz
Copy link
Contributor

@jbutz jbutz commented Oct 3, 2018

Currently all times come through as UTC, but that is not friendly for less technical user. This update takes advantage of SQLite storing timestamps in UTC and adds the date-fns format function to the client to convert the timestamp to the display format in the browser. This results in the time coming through as the visitor's timezone, according to their system clock.

The timestamp saved in the database is UTC based on my testing and what
I could find online. The SQLite documentation was a bit vauge around this.

Since the timestamp being returned is already UTC I am just converting in the
browser, since it will use the client's local timezone.

I'va also adjusted things to format the timestamp in the browser instead of on
the server. This is allowing us to take advantage of that conversion to local time
@jbutz
Copy link
Contributor Author

jbutz commented Oct 4, 2018

This should address #73

@g-div
Copy link
Member

g-div commented Oct 5, 2018

Definetively a good idea, but we could eventually use .toLocaleString() in the client trying to save the additional 8KB which will otherwise double schnack's size. Or am I wrong there ?

@jbutz
Copy link
Contributor Author

jbutz commented Oct 5, 2018

Yeah, that would definitely be an option. I completely forgot about, it is just harder to make things display a certain way.

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