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

Site uses local time instead of Unix time #10

Open
juuyokka opened this issue Jan 31, 2019 · 6 comments
Open

Site uses local time instead of Unix time #10

juuyokka opened this issue Jan 31, 2019 · 6 comments

Comments

@juuyokka
Copy link

When accessing the website in a timezone other than PST (Pacific Standard Time), the site incorrectly uses the local time.

Steps to Reproduce

  1. Enable a VPN that allows you to appear in a different country/timezone.
  2. Go to https://classclock.app/

How to Fix
Utilize Unix time rather than local time

@MoralCode
Copy link
Owner

Thank you so much for the feedback!

ClassClock is intended to be used within the local area of each participating school. Maybe i'm missing something, but at this point I don't see any planned or current use cases that would require times to be accurate across multiple timezones. Did you have a particular situation in mind in which timezones would be an issue?

@juuyokka
Copy link
Author

juuyokka commented Feb 1, 2019

There's a couple possibilities that may cause some issues/inaccuracies:

  1. Using the site concurrently with a VPN (as they may change your apparent location)
  2. Checking the schedule of a school outside of your timezone

The last one was brought to my attention when I gave the site to my friend in Canada (who is in EST).
I am a student at the school and when my friend looked at the site it said "No Class" when I was in 3rd period.

When being accessed in EST, the time was ahead by 3 hours.

Perhaps there could be a query string in the URL to specify the school?

The URL: https://classclock.app?school=[name of school] could be used to specify what school schedule to use. If there is no query string in the URL, then ClassClock would use the schedule of the closest school.

@MoralCode
Copy link
Owner

MoralCode commented Feb 2, 2019

Thanks for clarifying!

Point 1
The site uses the your device's local time as accessed through the javascript Date() function so as far as i'm aware the time displayed should not be affected by your apparent location, only the time set on your device.

Point 2
I see how this could potentially be a useful feature for students to give grandparents in other timezones .etc. I will add this issue to the list of stuff that needs working on, however it might be a while before it gets implemented since due to other tasks taking priority for the moment.

RE: Multiple schools
I do plan to add support for multiple schools and choosing between them, however, with regard to the many school-security-related events that have been happening recently (at least in the US), I would like to try and do it in such a way that ClassClock does not easily become a repository for just anyone to look up any other schools schedule, particularly if individual schools would prefer to keep tighter control over who has access to their schedules.

I am currently working on migrating the school schedule information to a database in order to allow multiple schools to add their schedules at some point in the future, however if you would like to submit a pull request to help expedite the implementation of this feature, feel free to do so!

If you would like, I also have a slack workspace (invite linked at the bottom of the classclock.app webpage) for discussing the development of classclock and interacting with others who are interested in following ClassClock's progress.

Thanks again for your feedback!

@MoralCode
Copy link
Owner

MoralCode commented Sep 21, 2019

Ok, so this feature kinda got lost in the react rewrite, partly because i've not been entirely sure about whether this is something that all users are going to want to use. However I just had the idea to potentially implement this as a user-selectable in the app and/or prompt that the user receives whenever the school's timezone doesn't match the users current timezone.

Say ClassClock detects that the school was set up in PST and the user is in a different timezone (EST). The selection would offer the user two options:

  1. use local time/keep schedule if class gets out at 4pm (PST), ClassClock will display class as getting out at 4:00 EST, preserving the time-of-day accuracy.
  2. use school's time/convert schedule if class gets out at 4pm PST, ClassClock will display class as getting out at 7:00 EST, preserving the schedule accuracy.

For example, the second option would be useful for a parent who is on a work trip and wants to know when they should call their child in order to have them pick up during their lunch period and not during class.

@MoralCode
Copy link
Owner

MoralCode commented Dec 26, 2020

Considering the previous attempts at this were using moment, it seems like this article may be worth looking at, as well as Luxon's docs on how it compares to moment it seems like Luxon is a better bet for this. Especially since relative time seems to now be supported by browsers, which from the comparison to moment, seems like it hasn't yet been implemented in Luxon, but it is.

This would require a pretty substantial refactoring of some of the code to use UTC behind the scenes and set up a conversion "layer" to "translate" times as they pass to or from the UI.

As for the other side of the coin:

Since it sometimes relies on browsers' implementations of the Intl specifications, it doesn't provide some of Moment's most commonly-used features on all browsers. Relative date formatting is for instance not supported in IE11 and Safari (as of August 2020). Luxon's Intl features do not work as expected on sufficiently outdated browsers, whereas Moment's all work everywhere.

Edit: Migrated to Luxon as of 50bb237

@MoralCode
Copy link
Owner

Say ClassClock detects that the school was set up in PST and the user is in a different timezone (EST). The selection would offer the user two options: ...

Looking back, these options seem a bit backwards and may not be the most user friendly way to present it. A better option may be to have the options be:

  • "adjust to local timezone" - show the schedule adjusted to your timezone, preserving when class ends
  • "ignore timezone" - assume local time is in the same timezone as the school

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

No branches or pull requests

2 participants