Fix Garmin sync to handle PocketBase date strings
All checks were successful
Deploy / deploy (push) Successful in 2m38s
All checks were successful
Deploy / deploy (push) Successful in 2m38s
PocketBase returns date fields as ISO strings, not Date objects. The sync was failing with "e.getTime is not a function" because the code expected Date objects. - Export mapRecordToUser from pocketbase.ts - Use mapRecordToUser in cron route to properly parse dates - Add test for handling date fields as ISO strings Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -88,7 +88,7 @@ function parseDate(value: unknown): Date | null {
|
||||
/**
|
||||
* Maps a PocketBase record to our typed User interface.
|
||||
*/
|
||||
function mapRecordToUser(record: RecordModel): User {
|
||||
export function mapRecordToUser(record: RecordModel): User {
|
||||
return {
|
||||
id: record.id,
|
||||
email: record.email as string,
|
||||
|
||||
Reference in New Issue
Block a user