Options
All
  • Public
  • Public/Protected
  • All
Menu

Class DateParser

Hierarchy

  • DateParser

Index

Constructors

Methods

Constructors

constructor

  • new DateParser(path: string[], datePropNames: string[]): DateParser
  • Parameters

    • path: string[]

      keys that lead to datePropNames

    • datePropNames: string[]

      keys that contain date strings or numbers representing milliseconds since epoch

    Returns DateParser

Methods

parseToDates

  • parseToDates<T>(data: T): T
  • Goes through data, converting all fields with paths matching (path.)*datePropNames into a Date object by parsing value as milliseconds since epoch or ISO8601

    Type parameters

    • T

    Parameters

    • data: T

    Returns T

Static parseFromDates

  • parseFromDates<T>(data: T): T
  • Turns every Date object in data into number of milliseconds since unix epoc

    Type parameters

    • T

    Parameters

    • data: T

    Returns T