Fix work entry dates being stored as epoch milliseconds - #913
Open
devin-ai-integration[bot] wants to merge 2 commits into
Open
devin-ai-integration[bot] wants to merge 2 commits into
devin-ai-integration[bot] wants to merge 2 commits into
Conversation
Contributor
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Contributor
Author
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
CSV and PDF exports rendered the
Datecolumn as1786406400000instead of a date. Root cause is in persistence, not in the export code:workEntrySchemausesJoi.date(), which coerces the incoming"2024-03-09"string into a JSDate, and the sqlite3 driver binds aDateas epoch milliseconds. The UI happened to hide this because it rendersnew Date(entry.date), which parses the number fine; the exports write the raw column value.Fix normalizes the value at the write boundary:
dateis a day-granularDATEcolumn, so this also makesORDER BY we.date DESCsort lexicographically-correct ISO strings rather than mixing numbers and strings.Existing rows are unaffected because the database is in-memory and resets on restart. API responses now return
"2024-03-09"where they previously returned1786406400000; the frontend'snew Date(entry.date)calls handle both.Found while adding backend test coverage in #912 (which touches only test files).
Link to Devin session: https://partner-workshops.devinenterprise.com/sessions/b25a5ce29aa043b686d55c72d875b8ef