Options
All
  • Public
  • Public/Protected
  • All
Menu

Class DateUtils

Provides utilities to transform hydrated and persisted data.

Hierarchy

  • DateUtils

Index

Methods

Static Private formatMilliseconds

  • formatMilliseconds(value: number): string
  • Formats given number to "0x" format, e.g. if it is 1 then it will return "01".

    Parameters

    • value: number

    Returns string

Static Private formatZerolessValue

  • formatZerolessValue(value: number): string
  • Formats given number to "0x" format, e.g. if it is 1 then it will return "01".

    Parameters

    • value: number

    Returns string

Static mixedDateToDate

  • mixedDateToDate(mixedDate: Date | string, toUtc?: boolean, useMilliseconds?: boolean): Date
  • Converts given value into date object.

    Parameters

    • mixedDate: Date | string
    • Default value toUtc: boolean = false
    • Default value useMilliseconds: boolean = true

    Returns Date

Static mixedDateToDateString

  • mixedDateToDateString(value: Date | any): string | any
  • Converts given value into date string in a "YYYY-MM-DD" format.

    Parameters

    • value: Date | any

    Returns string | any

Static mixedDateToDatetimeString

  • mixedDateToDatetimeString(value: Date | any): string | any
  • Converts given value into datetime string in a "YYYY-MM-DD HH-mm-ss" format.

    Parameters

    • value: Date | any

    Returns string | any

Static mixedDateToTimeString

  • mixedDateToTimeString(value: Date | any, skipSeconds?: boolean): string | any
  • Converts given value into time string in a "HH:mm:ss" format.

    Parameters

    • value: Date | any
    • Default value skipSeconds: boolean = false

    Returns string | any

Static mixedDateToUtcDatetimeString

  • mixedDateToUtcDatetimeString(value: Date | any): string | any
  • Converts given value into utc datetime string in a "YYYY-MM-DD HH-mm-ss" format.

    Parameters

    • value: Date | any

    Returns string | any

Static mixedTimeToDate

  • mixedTimeToDate(value: Date | any): string | any
  • Converts given value into time string in a "HH:mm:ss" format.

    Parameters

    • value: Date | any

    Returns string | any

Static mixedTimeToString

  • mixedTimeToString(value: string | any, skipSeconds?: boolean): string | any
  • Converts given string value with "-" separator into a "HH:mm:ss" format.

    Parameters

    • value: string | any
    • Default value skipSeconds: boolean = false

    Returns string | any

Static normalizeHydratedDate

  • normalizeHydratedDate(mixedDate: Date | string | undefined): Date | string | undefined
  • Normalizes date object hydrated from the database.

    Parameters

    • mixedDate: Date | string | undefined

    Returns Date | string | undefined

Static simpleArrayToString

  • simpleArrayToString(value: any[] | any): string[] | any
  • Converts each item in the given array to string joined by "," separator.

    Parameters

    • value: any[] | any

    Returns string[] | any

Static simpleEnumToString

  • simpleEnumToString(value: any): string

Static simpleJsonToString

  • simpleJsonToString(value: any): string

Static stringToSimpleArray

  • stringToSimpleArray(value: string | any): string | any
  • Converts given string to simple array split by "," separator.

    Parameters

    • value: string | any

    Returns string | any

Static stringToSimpleEnum

Static stringToSimpleJson

  • stringToSimpleJson(value: any): any

Generated using TypeDoc