MoralCode / ClassClock

ClassClock is a free, easy-to-use web app for K-12 schools that provides an at-a-glance view of the school schedule
https://web.classclock.app
GNU Affero General Public License v3.0
33 stars 4 forks source link

Site uses local time instead of Unix time #10

Open juuyokka opened 5 years ago

juuyokka commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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 commented 3 years ago

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 50bb237df375168323c4d35fa2e8302a1abf97cc

MoralCode commented 3 years ago

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: