Skip to content

fix(data-grid): date timezone issues and move utils to data-grid.ts#1085

Merged
sadmann7 merged 3 commits into
mainfrom
sadman/better-date
Dec 31, 2025
Merged

fix(data-grid): date timezone issues and move utils to data-grid.ts#1085
sadmann7 merged 3 commits into
mainfrom
sadman/better-date

Conversation

@sadmann7
Copy link
Copy Markdown
Owner

  • Add parseLocalDate to parse YYYY-MM-DD as local date (avoids UTC shift)
  • Add formatDateToString to format Date using local components
  • Move getUrlHref, formatFileSize, getFileIcon to lib/data-grid.ts
  • Fix DateCell to correctly display selected dates without off-by-one errors

- Add parseLocalDate to parse YYYY-MM-DD as local date (avoids UTC shift)
- Add formatDateToString to format Date using local components
- Move getUrlHref, formatFileSize, getFileIcon to lib/data-grid.ts
- Fix DateCell to correctly display selected dates without off-by-one errors
Copilot AI review requested due to automatic review settings December 31, 2025 12:19
@vercel
Copy link
Copy Markdown

vercel Bot commented Dec 31, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
tablecn Ready Ready Preview, Comment Dec 31, 2025 0:26am

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses timezone-related bugs in date handling within the data grid component and consolidates utility functions into a centralized location. The changes prevent off-by-one date errors that occurred when dates were being parsed and formatted through UTC conversion.

  • Added new date utility functions (parseLocalDate, formatDateToString, formatDateForDisplay) that work with local time components to avoid timezone shifts
  • Moved utility functions (getUrlHref, formatFileSize, getFileIcon) from the component file to the centralized data-grid.ts library
  • Updated DateCell component to use the new local date parsing and formatting functions

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 3 comments.

File Description
src/lib/data-grid.ts Added new date utility functions and consolidated file/URL utilities from component file
src/components/data-grid/data-grid-cell-variants.tsx Removed local utility functions, updated imports, and fixed DateCell to use new timezone-safe date functions

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/lib/data-grid.ts Outdated
Comment thread src/lib/data-grid.ts Outdated
Comment thread src/lib/data-grid.ts Outdated
@sadmann7 sadmann7 merged commit 1e5e6c1 into main Dec 31, 2025
7 checks passed
@sadmann7 sadmann7 deleted the sadman/better-date branch December 31, 2025 12:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants