Edit UI: Use browser's date and time instead of getting date and time from the server
- Dominant language
- JavaScript
- Stars
- 23
- Forks
- 62
- Avg merge
- 24m
- Merged PRs (30d)
- 1
Description
## TODO
- [ ] Remove period call to web server for date and time
- [ ] Replace with store getter that returns date and time in Pacific time
- [ ] Check that the following getters ALWAYS returns Pacific time even when user's computer uses different timezone
- [ ] GetCurrentDate
- [ ] GetCurrentJSDate
- [ ] Also in Filings UI (create new ticket if it doesn't fit in this ticket)
- [ ] Also in Create UI (create new ticket if it doesn't fit in this ticket)
- [ ] Consider moving to a single Date Mixin (or Utilities) in shared repo instead (create new ticket if it doesn't fit in this ticket)
## What is the problem?
At present, our front-end application uses a function to retrieve the current date and time from the API instead of relying on the browser's date and time. My understanding is this functionality was added so the application didn't have to rely on the browser's date and time which might be set incorrectly, use a different time zone or be deliberately manipulated to use an incorrect time.
## What is the impact?
I think this adds unnecessary complexity and it's a non-standard approach that makes it more time consuming to troubleshoot and become familiar with the application.
## Proposed solution
Use the browser's date and time instead. Yes, it's true, the browser's date and time could be incorrect, but developers cannot trust any date provided by the front-end. All critical date and time validations must be handled by the API.
For example, if a user must submit a filing before midnight Vancouver time, we can't trust any date provided by the front-end. Instead, the submission must be validated by the server. If the filing is submitted late, the front-end has to gracefully handle the server's validation error. If the user is submitting the filing from Hawaii and her computer is using local Hawaii time, we can determine what the local Vancouver time is and let the user know the filing is late prior to submission.
In the case where a user wishes to have a filing take affect at a specified date and time, the user should approve the date and time before submission. Since this date is submitted as a string, there's no risk that the date is incorrect.
Contributor guide
No contributing guide indexed for this repository
Research direction
Locate the Edit UI callers of GetCurrentDate and GetCurrentJSDate, then trace the store getter and its current server date/time request. Check the Filings and Create UIs for the same behavior; done means the periodic request is removed, browser time is used, and both getters consistently return Pacific time regardless of the computer's timezone.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100