tsv2-library 1.0.59 → 1.0.60
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/utils/date.util.d.ts +15 -9
- package/dist/tsv2-library.es.js +2886 -2809
- package/dist/tsv2-library.umd.js +74 -74
- package/package.json +1 -1
|
@@ -10,21 +10,23 @@ type User = {
|
|
|
10
10
|
generalSetting: GeneralSetting;
|
|
11
11
|
[key: string]: unknown;
|
|
12
12
|
};
|
|
13
|
-
export type TDateFormat = 'd/m/yy' | 'd/mm/yy' | 'dd/mm/yy' | 'dd/mm/yyyy' | 'dd M yy' | 'dd M yyyy' | 'dd MM yy' | 'dd MM yyyy' | 'D dd M yy' | 'D dd M yyyy' | 'DD dd MM yy' | 'DD dd MM yyyy' | 'D, dd M yy' | 'D, dd M yyyy' | 'DD, dd MM yy' | 'DD, dd MM yyyy';
|
|
14
|
-
export type GoDateLayout = '02/01/06' | '_2/_1/06' | '02 Jan 06' | 'Mon, 02 Jan 06' | 'Mon, 02 Jan 2006';
|
|
13
|
+
export type TDateFormat = 'd/m/yy' | 'm/d/yy' | 'd/mm/yy' | 'dd/mm/yy' | 'dd/mm/yyyy' | 'dd M yy' | 'dd M yyyy' | 'dd MM yy' | 'dd MM yyyy' | 'D dd M yy' | 'D dd M yyyy' | 'DD dd MM yy' | 'DD dd MM yyyy' | 'D, dd M yy' | 'D, dd M yyyy' | 'DD, dd MM yy' | 'DD, dd MM yyyy';
|
|
14
|
+
export type GoDateLayout = '02/01/06' | '_2/_1/06' | '_1/_2/06' | '02 Jan 06' | 'Mon, 02 Jan 06' | 'Mon, 02 Jan 2006';
|
|
15
15
|
export type TTimeFormat = 'HH:mm' | 'HH:mm a' | 'HH:mm:ss' | 'HH:mm:ss a';
|
|
16
16
|
export type GoTimeLayout = '15:04' | '03:04 PM' | '15:04:05' | '03:04:05 PM';
|
|
17
|
-
export type
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
export type CustomDateTimeFormatOptions = Omit<Intl.DateTimeFormatOptions, 'timeZone'> & {
|
|
18
|
+
timezone?: string;
|
|
19
|
+
locale?: string;
|
|
20
|
+
};
|
|
21
|
+
export type DateOptions = {
|
|
21
22
|
locale?: string;
|
|
22
23
|
dateFormat?: TDateFormat | GoDateLayout;
|
|
23
24
|
timeFormat?: TTimeFormat | GoTimeLayout;
|
|
25
|
+
timezone?: string;
|
|
24
26
|
/**
|
|
25
27
|
* Show the time in the formatted date.
|
|
26
28
|
*
|
|
27
|
-
* @default
|
|
29
|
+
* @default false - But will be set to true when `DateOptions.timeFormat` is provided
|
|
28
30
|
*/
|
|
29
31
|
showTime?: boolean;
|
|
30
32
|
/**
|
|
@@ -33,10 +35,14 @@ export type TTimeOptions = {
|
|
|
33
35
|
* @default true
|
|
34
36
|
*/
|
|
35
37
|
showDate?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* This is old format (general settings), if configuration still using old settings then this option parameter can be used
|
|
40
|
+
*/
|
|
41
|
+
formatPreset?: CustomDateTimeFormatOptions;
|
|
36
42
|
};
|
|
37
43
|
export declare const getLoggedInUser: () => User;
|
|
38
44
|
export declare const getUserLocale: () => string;
|
|
39
|
-
export declare const formatGoDate: (date: Date, options?:
|
|
45
|
+
export declare const formatGoDate: (date: Date, options?: DateOptions, useGeneralSettings?: boolean) => string;
|
|
40
46
|
/**
|
|
41
47
|
* Formats a date according to the user's general settings.
|
|
42
48
|
*
|
|
@@ -44,7 +50,7 @@ export declare const formatGoDate: (date: Date, options?: TTimeOptions) => strin
|
|
|
44
50
|
* @param useTimeOrFormat - Whether to include the time in the formatted date string. Defaults to false.
|
|
45
51
|
* @returns The formatted date string.
|
|
46
52
|
*/
|
|
47
|
-
export declare const formatDate: (date: Date | string | null | undefined, useTimeOrFormat?: boolean |
|
|
53
|
+
export declare const formatDate: (date: Date | string | null | undefined, useTimeOrFormat?: boolean | DateOptions) => string;
|
|
48
54
|
/**
|
|
49
55
|
* Formats a date to human readable form (timeago / relative time from now).
|
|
50
56
|
*
|