Function: convertDateForDb()
convertDateForDb(
value:string|Date|null|undefined):string|null
Defined in: electron/services/database/utils/valueConverters.ts:161
Convert a date-like value to ISO string or null for database storage.
Parameters
value
The date value to convert (Date object, string, null, or undefined)
string | Date | null | undefined
Returns
string | null
ISO string representation for valid dates, null for invalid/empty values
Remarks
Handles various date input types for consistent database storage:
- Date objects: converted to ISO string format
- String values: preserved as-is (assumed to be valid date strings)
- Null/undefined/falsy values: converted to null for database NULL storage
The function prioritizes data safety by converting uncertain values to null rather than attempting invalid date parsing.