Open Bug 1934157 Opened 6 days ago Updated 1 day ago

Date can change unexpectedly

Categories

(Firefox :: PDF Viewer, defect, P1)

defect

Tracking

()

ASSIGNED

People

(Reporter: chunmin, Assigned: calixte)

References

Details

Attachments

(4 files)

Attach (recommended) or Link to PDF file here:

Steps to reproduce the problem:

  1. Open the uploaded pdf, or download one in https://mozilla.app.box.com/s/lcla8pvbno8cn21bvi1gmhng8muga6t8 in Firefox Nightly (135.0a1 (2024-11-28) (aarch64))
  2. On "Date of Birth (mm/dd/yyyy)", Enter "02/01/2000" or "04/01/2000" or "06/01/2000" or "09/01/2000" or "11/01/2000"

What is the expected behavior? (add screenshot)
The date should be the filled date
https://bug1934157.bmoattachments.org/attachment.cgi?id=9440659

What went wrong? (add screenshot)
The month is advanced unexpectedly to "03/01/2000" or "05/01/2000" or "07/01/2000" or "10/01/2000" or "12/01/2000"
https://bug1934157.bmoattachments.org/attachment.cgi?id=9440660

Attached image expected result
Attached image unexpected result

I can't reproduce this issue neither on Windows nor Mac with the last nightly.
After thinking about that, I think it's a timezone issue:

  • let say the user is UTC-6;
  • we create a new Date(0), which is the 1st of January in UTC+0 so it's the 31st of Dec in the user tz;
  • then we set the month to Feb which has only 28 days, so the date is the 3rd of Mar in the user tz;
  • then we set the day and the year and we've the 1st of March 2000 in the user tz.

Instead of setting month, day, year, ... on the initial date, we must create the date from the date we've, i.e. new Date(y, m, ...).

Assignee: nobody → cdenizet
Severity: -- → S3
Status: NEW → ASSIGNED
Priority: -- → P1
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: