parse-dashboard icon indicating copy to clipboard operation
parse-dashboard copied to clipboard

TimeZone Toggle Feature for Date Display

Open badboy-tian opened this issue 11 months ago • 3 comments

New Pull Request Checklist

  • [x] I am not disclosing a vulnerability.
  • [ ] I am creating this PR in reference to an issue.

Issue Description

Add timezone toggle feature to allow switching between UTC and local time display for date fields in the data browser. Currently, dates are always displayed in UTC format which can be confusing for users working in different timezones.

Closes: n/a

Approach

  1. Added new TimeZoneToggle component:

    • Simple toggle switch with visual feedback (grey/green)
    • Persists user preference in localStorage
    • Displays UTC/Local indicator
  2. Modified date handling:

    • Updated DateTimeEditor to consistently use UTC format during editing
    • Added formatDateTime utility for consistent date formatting
    • Implemented timezone conversion in BrowserRow component
  3. UI Integration:

    • Added timezone toggle to BrowserToolbar
    • Maintained UTC format in edit mode for data consistency
    • Added useLocalTime prop propagation through component hierarchy

TODOs before merging

  • [ ] Add tests
  • [ ] Add changes to documentation (guides, repository pages, in-code descriptions) ####Before image ####After image

I am in china. so the local time = utc + 8 hour

badboy-tian avatar Dec 13 '24 08:12 badboy-tian

Thanks for opening this pull request!

  • ❌ Please link an issue that describes the reason for this pull request, otherwise your pull request will be closed. Make sure to write it as Closes: #123 in the PR description, so I can recognize it.

Uffizzi Ephemeral Environment deployment-59082

:watch: Updated Dec 13, 2024, 08:10 UTC

:cloud: https://app.uffizzi.com/github.com/parse-community/parse-dashboard/pull/2632

:page_facing_up: View Application Logs etc.

What is Uffizzi? Learn more

uffizzi-cloud[bot] avatar Dec 13 '24 08:12 uffizzi-cloud[bot]

Nice! I'm don't think most users will toggle often back and forth, so I suggest to remove the toggle and instead add a image button between "Export" and "Refresh". Then add a menu item that toggles between "Show dates in UTC" and "Show dates in local time".

Is this feature only for date display, or also for date entry, so that when entering a date in local time, and the date display is set to local, it will be converted to UTC before sending it to Parse Server?

Could you please also link the related issue?

mtrezza avatar Dec 13 '24 16:12 mtrezza