tsv2-library 1.0.57 → 1.0.59

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.
@@ -12,6 +12,10 @@ export interface BadgeProps {
12
12
  * Wether the badge text is editable.
13
13
  */
14
14
  editable?: boolean;
15
+ /**
16
+ * Maximum length of the editable text.
17
+ */
18
+ editMaxlength?: number;
15
19
  /**
16
20
  * Sets the severity level for styling purposes.
17
21
  */
@@ -27,6 +27,6 @@ export type GeneralSetting = {
27
27
  label: string;
28
28
  };
29
29
  timezone: string;
30
- dateFormat: DateFormat;
30
+ dateFormat: DateFormat | string;
31
31
  timeFormat: boolean;
32
32
  };
@@ -10,16 +10,41 @@ 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';
15
+ export type TTimeFormat = 'HH:mm' | 'HH:mm a' | 'HH:mm:ss' | 'HH:mm:ss a';
16
+ export type GoTimeLayout = '15:04' | '03:04 PM' | '15:04:05' | '03:04:05 PM';
17
+ export type TTimeOptions = {
18
+ /**
19
+ * @default 'en-GB'
20
+ */
21
+ locale?: string;
22
+ dateFormat?: TDateFormat | GoDateLayout;
23
+ timeFormat?: TTimeFormat | GoTimeLayout;
24
+ /**
25
+ * Show the time in the formatted date.
26
+ *
27
+ * @default true - when timeFormat is provided
28
+ */
29
+ showTime?: boolean;
30
+ /**
31
+ * Show the date in the formatted date.
32
+ *
33
+ * @default true
34
+ */
35
+ showDate?: boolean;
36
+ };
13
37
  export declare const getLoggedInUser: () => User;
14
38
  export declare const getUserLocale: () => string;
39
+ export declare const formatGoDate: (date: Date, options?: TTimeOptions) => string;
15
40
  /**
16
41
  * Formats a date according to the user's general settings.
17
42
  *
18
43
  * @param date - The date to be displayed. Can be a Date object or a string in a recognized date format.
19
- * @param useTime - Whether to include the time in the formatted date string. Defaults to false.
44
+ * @param useTimeOrFormat - Whether to include the time in the formatted date string. Defaults to false.
20
45
  * @returns The formatted date string.
21
46
  */
22
- export declare const formatDate: (date: Date | string | null | undefined, useTime?: boolean) => string;
47
+ export declare const formatDate: (date: Date | string | null | undefined, useTimeOrFormat?: boolean | TTimeOptions) => string;
23
48
  /**
24
49
  * Formats a date to human readable form (timeago / relative time from now).
25
50
  *