Function: prepareDate()
Call Signature
ts
function prepareDate(key: string, value: unknown, nullable: true): Date | null;Prepares a date value for database storage with nullable support and enhanced string parsing
Parameters
| Parameter | Type | Description |
|---|---|---|
key | string | The field name for error reporting |
value | unknown | The value to prepare |
nullable | true | Whether the field can be null |
Returns
Date | null
The prepared DateTime value or null if nullable and value is null
Throws
E_INVALID_PREPARED_VALUE when the value cannot be prepared
Remarks
For string values, attempts SQL format parsing first, then falls back to ISO format parsing
Call Signature
ts
function prepareDate(key: string, value: unknown, nullable?: false): Date;Prepares a date value for database storage with nullable support and enhanced string parsing
Parameters
| Parameter | Type | Description |
|---|---|---|
key | string | The field name for error reporting |
value | unknown | The value to prepare |
nullable? | false | Whether the field can be null |
Returns
Date
The prepared DateTime value or null if nullable and value is null
Throws
E_INVALID_PREPARED_VALUE when the value cannot be prepared
Remarks
For string values, attempts SQL format parsing first, then falls back to ISO format parsing