Summary
All Zod schemas in the SDK currently define date/timestamp fields (e.g. createdAt, updatedAt, completedAt, addedAt, postedAt) as z.string(), meaning consumers receive raw ISO strings rather than Date objects.
These should be migrated to use z.coerce.date() so consumers get proper Date objects.
Affected fields (~32 across 15 files)
Sync resources (src/types/sync/resources/):
workspace-goals.ts — createdAt, updatedAt
workspace-filters.ts — createdAt, updatedAt
workspaces.ts — createdAt, dateCreated
live-notifications.ts — createdAt
notes.ts — postedAt
user.ts — joinedAt, premiumUntil, freeTrailExpires, resetDate
Entity types (src/types/):
tasks/types.ts — addedAt, completedAt, updatedAt
projects/types.ts — createdAt, updatedAt
sections/types.ts — addedAt, updatedAt
comments/types.ts — postedAt
activity/types.ts — eventDate
insights/types.ts — date, createdAt, updatedAt, completedAt
Breaking change
This is a breaking change — all affected fields change their TypeScript type from string to Date. Any consumer code that does string operations on these fields (e.g. task.createdAt.startsWith(...), template literals, comparisons) will fail to compile. This should be released as a major version bump.
Proposed approach
Use z.coerce.date() on each field, which accepts ISO date strings and coerces them to Date objects.
Summary
All Zod schemas in the SDK currently define date/timestamp fields (e.g.
createdAt,updatedAt,completedAt,addedAt,postedAt) asz.string(), meaning consumers receive raw ISO strings rather thanDateobjects.These should be migrated to use
z.coerce.date()so consumers get properDateobjects.Affected fields (~32 across 15 files)
Sync resources (
src/types/sync/resources/):workspace-goals.ts—createdAt,updatedAtworkspace-filters.ts—createdAt,updatedAtworkspaces.ts—createdAt,dateCreatedlive-notifications.ts—createdAtnotes.ts—postedAtuser.ts—joinedAt,premiumUntil,freeTrailExpires,resetDateEntity types (
src/types/):tasks/types.ts—addedAt,completedAt,updatedAtprojects/types.ts—createdAt,updatedAtsections/types.ts—addedAt,updatedAtcomments/types.ts—postedAtactivity/types.ts—eventDateinsights/types.ts—date,createdAt,updatedAt,completedAtBreaking change
This is a breaking change — all affected fields change their TypeScript type from
stringtoDate. Any consumer code that does string operations on these fields (e.g.task.createdAt.startsWith(...), template literals, comparisons) will fail to compile. This should be released as a major version bump.Proposed approach
Use
z.coerce.date()on each field, which accepts ISO date strings and coerces them toDateobjects.