Skip to content

utils/converter

Documentation

Overview

Classes

Converter

setDate()

Converts a date property value within an object into a Unix timestamp (milliseconds since epoch).

ts
static setDate(obj: any, property: string): void;
ParameterTypeDescription
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.

ts
static setLocalDate(obj: any, property: string): void;
ParameterTypeDescription
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.

ts
static setBoolean(obj: any, property: string): void;
ParameterTypeDescription
objanyThe object containing the property to be converted.
propertystringThe string name of the boolean property (e.g., 'isActive').

Returns

  • Type: void
  • Description: