Closed
Bug 1085676
Opened 11 years ago
Closed 5 years ago
Cannot add report for today due to timezone issue
Categories
(Mozilla Reps Graveyard :: reps.mozilla.org, defect, P4)
Mozilla Reps Graveyard
reps.mozilla.org
Tracking
(Not tracked)
RESOLVED
WONTFIX
People
(Reporter: Unfocused, Assigned: fossbalaji)
Details
(Whiteboard: [reports])
When I try to submit a report for today, I get the following error message:
"Report date cannot be in the future."
I can only assume this is due to "the future" being calculated on the server, using the server's timezone. I'm in New Zealand (GMT+13) - so while it may seem like I'm from the future, it is indeed possible for me to accomplish things during what appears to be tomorrow but is in fact today for me.
Updated•8 years ago
|
Priority: -- → P2
I would like to work on this bug and wanna know where this occurs ?
Comment 2•7 years ago
|
||
This happens when creating a new report (https://reps.mozilla.org/reports/new/) and the timezone is far enough to be a date in the future in the view of a server.
Example:
UTC is 9pm, Japan is already at 6am the next day though. This means the server expects "February 12th" as a date, but the local user time is already "February 13th" and therefore validation fails.
Do you see what I mean?
(In reply to Michael Kohler [:mkohler] from comment #2)
> This happens when creating a new report
> (https://reps.mozilla.org/reports/new/) and the timezone is far enough to be
> a date in the future in the view of a server.
>
> Example:
> UTC is 9pm, Japan is already at 6am the next day though. This means the
> server expects "February 12th" as a date, but the local user time is already
> "February 13th" and therefore validation fails.
>
> Do you see what I mean?
I got what you are saying. so do i need to login as an admin to create a report?
Comment 4•7 years ago
|
||
(In reply to Balaji from comment #3)
> I got what you are saying. so do i need to login as an admin to create a
> report?
No, every Rep can file a report: https://reps.mozilla.org/reports/new/
But yes, you need to go through /admin to log in to the portal. Probably best to create a new user through the Django admin interface and mark it as "staff" so login work.
I have got the issue . I have few suggestions
1. is possible to get user's timezone from request or frontend?. Then we can get the time of their timezone and compare the date in backend .
2. if there is no way to get user's timezone , then we need to think of allowing one day greater than today or someother way to achieve this comparison?
Comment 6•7 years ago
|
||
The timezone is on the user's profile, but I'm not sure if we can assume that the user always is in that timezone. Another idea would be to get the timezone from the location the user selects while doing the report, but we would need some kind of lookup mechanism for that.
I think I'd be okay with allowing reports generally that are one day in the future from the server's point of view.
Daniele, what do you think?
Flags: needinfo?(mte90net)
Comment 7•7 years ago
|
||
As I can see with JavaScript is possible get the timezone with `Intl.DateTimeFormat().resolvedOptions().timeZone` (tried right now in my browser console just to be sure). This API is supported by a lot of browsers https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat and with that later is possible to count the right time.
From the Django side seems that this framework support only the datetime picker to use later so if we want to use the timezone in the moment of visiting the page (that can be different from the configured one) JavaScript is the only way.
Flags: needinfo?(mte90net)
Even though we get timezone info from frontend , when comparing date in backend we need to get that user's timezone's time and validate.
Comment 9•7 years ago
|
||
I think that from the frontend we can send the timezone when the user publish a report so the backend has this value during the evaluation.
Assignee | ||
Comment 10•7 years ago
|
||
Fine. I will make the changes in both frontend and bakend also. Thanks for the info @Daniele and @Michael.
Assignee | ||
Comment 11•7 years ago
|
||
Hi ,
I have made a pull request .
https://github.com/mozilla/remo/pull/1439
Updated•7 years ago
|
Assignee: nobody → fossbalaji
Updated•7 years ago
|
Status: NEW → ASSIGNED
Updated•7 years ago
|
Whiteboard: [reports]
Updated•7 years ago
|
Priority: P2 → P4
Updated•6 years ago
|
Type: task → defect
Comment 12•5 years ago
|
||
As we've moved from reps.mozilla.org to the Community Portal, I'm closing this bug. Filter out these emails by searching for "REPS_PORTAL_BUG_CLOSURE"
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → WONTFIX
Updated•5 years ago
|
Product: Mozilla Reps → Mozilla Reps Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•