@verifiedinc-public/shared-ui-elements 0.14.5-beta.0 → 0.14.5-beta.2
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/utils/date.d.ts
CHANGED
@@ -4,5 +4,4 @@
|
|
4
4
|
* @param separator
|
5
5
|
*/
|
6
6
|
export declare const formatDateMMDDYYYY: (timestamp?: string) => string;
|
7
|
-
export declare const
|
8
|
-
export declare const getMaxDateInstance: (allowFutureDates?: boolean) => Date;
|
7
|
+
export declare const formatDateToTimestamp: (dateValue: number | string | Date) => string;
|
package/package.json
CHANGED
package/src/utils/date.ts
CHANGED
@@ -21,21 +21,12 @@ export const formatDateMMDDYYYY = (timestamp?: string): string => {
|
|
21
21
|
return [month, day, year].join('/');
|
22
22
|
};
|
23
23
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
minYear = 1900,
|
29
|
-
): Date => {
|
30
|
-
return new Date(minYear, minMonth - 1, minDate, 0, 0, 0, 0);
|
31
|
-
};
|
24
|
+
export const formatDateToTimestamp = (
|
25
|
+
dateValue: number | string | Date,
|
26
|
+
): string => {
|
27
|
+
const date = new Date(dateValue);
|
32
28
|
|
33
|
-
|
34
|
-
export const getMaxDateInstance = (allowFutureDates = true): Date => {
|
35
|
-
const nowDate = new Date();
|
36
|
-
const maxDate = allowFutureDates ? 31 : nowDate.getDate();
|
37
|
-
const maxMonth = allowFutureDates ? 12 : nowDate.getMonth() + 1;
|
38
|
-
const maxYear = allowFutureDates ? 2200 : nowDate.getFullYear();
|
29
|
+
date.setUTCHours(12);
|
39
30
|
|
40
|
-
return
|
31
|
+
return String(+date);
|
41
32
|
};
|