PoskOfficial / Nepali-calendar-web

A PWA for minimal Nepali Calendar
https://miti.bikram.io/
BSD 2-Clause "Simplified" License
86 stars 22 forks source link

Fix Date Display Discrepancy in Input Field #57

Closed pandeysubash404 closed 1 year ago

pandeysubash404 commented 1 year ago

Dear Developer,

I am pleased to submit a pull request to address the date display discrepancy issue in your code. The issue was related to inconsistent handling of time zones, resulting in the date appearing one day behind in the input field while being displayed correctly in the paragraph.

Solution Description: To resolve the problem #56 , I made the following adjustments to the code:

  1. Modified the code responsible for assigning the value to the input field to consider the user's local time zone offset. This ensures that the date displayed in the input field aligns with the user's local date.
  2. The code adjustment utilizes the date.getTimezoneOffset() method to retrieve the time zone offset in minutes between the user's local time zone and UTC. It then calculates the adjusted time in milliseconds, taking the offset into account.
  3. The adjusted time is converted to an ISO string, and only the date portion is extracted and displayed in the input field.

With these changes, the date display in the input field is now consistent with the date displayed in the paragraph, regardless of the user's time zone.

I have thoroughly tested the modified code, and it successfully resolves the date display issue. The input field now accurately shows the date, ensuring a seamless and user-friendly experience.

Thank you for the opportunity to contribute to your project. I hope my fix proves helpful, and if you have any further questions or require additional support, please do not hesitate to let me know.

vercel[bot] commented 1 year ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
nepali-calendar-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 21, 2023 1:06pm
Parajulibkrm commented 1 year ago

You have added pnpm to the dependency and not even dev dependency, could you please remove the changes in package.json package-lock.json and pnpm-lock, so that I can merge this?

pandeysubash404 commented 1 year ago

You have added pnpm to the dependency and not even dev dependency, could you please remove the changes in package.json package-lock.json and pnpm-lock, so that I can merge this?

Hi @Parajulibkrm ,

I have removed the "pnpm" dependency from the project as requested. The changes to package.json, package-lock.json, and pnpm-lock.yaml files have been made, and the branch is now updated and ready for review and merge.

Please let me know if there's anything else I can assist with.

Best regards, Subash Pandey

Parajulibkrm commented 1 year ago

LGTM, Thanks.