utils/converter
Documentation
- source: utils/converter.ts
Overview
Classes
Converter
setDate()
Converts a date property value within an object into a Unix timestamp (milliseconds since epoch).
tsstatic setDate(obj: any, property: string): void;
Parameter Type Description objanyThe object containing the property to be converted. propertystringThe string name of the date property (e.g., 'dateCreated'). Returns
- Type:
void- Description:
setLocalDate()
Converts a date property value into an ISO 8601 string, adjusted to represent the start of that day (local midnight) to handle timezone offsets consistently. This is typically used for fields that should represent a date only, without time of day ambiguity.
tsstatic setLocalDate(obj: any, property: string): void;
Parameter Type Description objanyThe object containing the property to be converted. propertystringThe string name of the date property (e.g., 'birthday'). Returns
- Type:
void- Description:
setBoolean()
Explicitly coerces a property value to a strict boolean type (`true` or `false`). This handles truthy/falsy values like `1`, `0`, `null`, and empty strings.
tsstatic setBoolean(obj: any, property: string): void;
Parameter Type Description objanyThe object containing the property to be converted. propertystringThe string name of the boolean property (e.g., 'isActive'). Returns
- Type:
void- Description:
