Fix Invalid Date for API-created history records#559
Open
scowalt wants to merge 1 commit into
Open
Conversation
Records created via create_history_record or update_history_record
show "Invalid Date" on iOS Safari/WebKit because the `date` field
stores the raw Liftohistory text format ("2026-02-28 10:45:30 +00:00"
with space separator). Safari's Date.parse() requires strict ISO 8601
with the T separator and returns NaN for space-separated dates.
Use parsedDate.toISOString() to store "2026-02-28T10:45:30.000Z"
instead, matching what the app itself stores when creating records
through the normal UI flow (e.g. Program.createHistory, Progress.changeDate).
Author
|
I generated this with Claude Code but it reflects a real issue I've been having, lmk if you have concerns or if anything is unclear |
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
History records created via the MCP API (
create_history_record/update_history_record) display "Invalid Date" on iOS Safari/WebKit.Root cause: The
datefield inLiftohistoryDeserializerstores the raw Liftohistory text format:iOS Safari's
Date.parse()requires strict ISO 8601 with theTseparator and returnsNaNfor space-separated date strings, causing "Invalid Date" in the UI.Fix: Use
parsedDate.toISOString()(which is already a correctly parsedDateobject on line 138) to store:This matches what the app stores when creating records through the normal UI flow (
Program.createHistory,Progress.changeDate).Reproduction
Change
One-line change in
src/liftohistory/liftohistoryDeserializer.ts: