1 | import { ColumnMetadata } from "../metadata/ColumnMetadata";
|
2 | /**
|
3 | * Provides utilities to transform hydrated and persisted data.
|
4 | */
|
5 | export declare class DateUtils {
|
6 | /**
|
7 | * Normalizes date object hydrated from the database.
|
8 | */
|
9 | static normalizeHydratedDate(mixedDate: Date | string | undefined): Date | string | undefined;
|
10 | /**
|
11 | * Converts given value into date string in a "YYYY-MM-DD" format.
|
12 | */
|
13 | static mixedDateToDateString(value: Date | any): string | any;
|
14 | /**
|
15 | * Converts given value into date object.
|
16 | */
|
17 | static mixedDateToDate(mixedDate: Date | string, toUtc?: boolean, useMilliseconds?: boolean): Date;
|
18 | /**
|
19 | * Converts given value into time string in a "HH:mm:ss" format.
|
20 | */
|
21 | static mixedDateToTimeString(value: Date | any, skipSeconds?: boolean): string | any;
|
22 | /**
|
23 | * Converts given value into time string in a "HH:mm:ss" format.
|
24 | */
|
25 | static mixedTimeToDate(value: Date | any): string | any;
|
26 | /**
|
27 | * Converts given string value with "-" separator into a "HH:mm:ss" format.
|
28 | */
|
29 | static mixedTimeToString(value: string | any, skipSeconds?: boolean): string | any;
|
30 | /**
|
31 | * Converts given value into datetime string in a "YYYY-MM-DD HH-mm-ss" format.
|
32 | */
|
33 | static mixedDateToDatetimeString(value: Date | any): string | any;
|
34 | /**
|
35 | * Converts given value into utc datetime string in a "YYYY-MM-DD HH-mm-ss.sss" format.
|
36 | */
|
37 | static mixedDateToUtcDatetimeString(value: Date | any): string | any;
|
38 | /**
|
39 | * Converts each item in the given array to string joined by "," separator.
|
40 | */
|
41 | static simpleArrayToString(value: any[] | any): string[] | any;
|
42 | /**
|
43 | * Converts given string to simple array split by "," separator.
|
44 | */
|
45 | static stringToSimpleArray(value: string | any): string | any;
|
46 | static simpleJsonToString(value: any): string;
|
47 | static stringToSimpleJson(value: any): any;
|
48 | static simpleEnumToString(value: any): string;
|
49 | static stringToSimpleEnum(value: any, columnMetadata: ColumnMetadata): any;
|
50 | /**
|
51 | * Formats given number to "0x" format, e.g. if it is 1 then it will return "01".
|
52 | */
|
53 | private static formatZerolessValue;
|
54 | /**
|
55 | * Formats given number to "0x" format, e.g. if it is 1 then it will return "01".
|
56 | */
|
57 | private static formatMilliseconds;
|
58 | }
|