@greatapps/common 1.1.532 → 1.1.533
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.
|
@@ -3,6 +3,9 @@ function formatShortDate(date) {
|
|
|
3
3
|
const d = new Date(date);
|
|
4
4
|
const day = String(d.getDate()).padStart(2, "0");
|
|
5
5
|
const month = String(d.getMonth() + 1).padStart(2, "0");
|
|
6
|
+
if (d.getFullYear() !== (/* @__PURE__ */ new Date()).getFullYear()) {
|
|
7
|
+
return `${day}/${month}/${d.getFullYear()}`;
|
|
8
|
+
}
|
|
6
9
|
return `${day}/${month}`;
|
|
7
10
|
}
|
|
8
11
|
function formatDateTime(date) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/infra/utils/date.ts"],"sourcesContent":["export function formatShortDate(date: Date | string | null | undefined): string {\n if (!date) return '--';\n const d = new Date(date);\n const day = String(d.getDate()).padStart(2, '0');\n const month = String(d.getMonth() + 1).padStart(2, '0');\n return `${day}/${month}`;\n}\n\nexport function formatDateTime(date: Date | string | null | undefined): string | null {\n if (!date) return null;\n return new Date(date).toLocaleString('pt-BR', {\n day: '2-digit',\n month: '2-digit',\n year: 'numeric',\n hour: '2-digit',\n minute: '2-digit',\n });\n}\n"],"mappings":"AAAO,SAAS,gBAAgB,MAAgD;AAC9E,MAAI,CAAC,KAAM,QAAO;AAClB,QAAM,IAAI,IAAI,KAAK,IAAI;AACvB,QAAM,MAAM,OAAO,EAAE,QAAQ,CAAC,EAAE,SAAS,GAAG,GAAG;AAC/C,QAAM,QAAQ,OAAO,EAAE,SAAS,IAAI,CAAC,EAAE,SAAS,GAAG,GAAG;AACtD,SAAO,GAAG,GAAG,IAAI,KAAK;AACxB;AAEO,SAAS,eAAe,MAAuD;AACpF,MAAI,CAAC,KAAM,QAAO;AAClB,SAAO,IAAI,KAAK,IAAI,EAAE,eAAe,SAAS;AAAA,IAC5C,KAAK;AAAA,IACL,OAAO;AAAA,IACP,MAAM;AAAA,IACN,MAAM;AAAA,IACN,QAAQ;AAAA,EACV,CAAC;AACH;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../src/infra/utils/date.ts"],"sourcesContent":["export function formatShortDate(date: Date | string | null | undefined): string {\n if (!date) return '--';\n const d = new Date(date);\n const day = String(d.getDate()).padStart(2, '0');\n const month = String(d.getMonth() + 1).padStart(2, '0');\n if (d.getFullYear() !== new Date().getFullYear()) {\n return `${day}/${month}/${d.getFullYear()}`;\n }\n return `${day}/${month}`;\n}\n\nexport function formatDateTime(date: Date | string | null | undefined): string | null {\n if (!date) return null;\n return new Date(date).toLocaleString('pt-BR', {\n day: '2-digit',\n month: '2-digit',\n year: 'numeric',\n hour: '2-digit',\n minute: '2-digit',\n });\n}\n"],"mappings":"AAAO,SAAS,gBAAgB,MAAgD;AAC9E,MAAI,CAAC,KAAM,QAAO;AAClB,QAAM,IAAI,IAAI,KAAK,IAAI;AACvB,QAAM,MAAM,OAAO,EAAE,QAAQ,CAAC,EAAE,SAAS,GAAG,GAAG;AAC/C,QAAM,QAAQ,OAAO,EAAE,SAAS,IAAI,CAAC,EAAE,SAAS,GAAG,GAAG;AACtD,MAAI,EAAE,YAAY,OAAM,oBAAI,KAAK,GAAE,YAAY,GAAG;AAChD,WAAO,GAAG,GAAG,IAAI,KAAK,IAAI,EAAE,YAAY,CAAC;AAAA,EAC3C;AACA,SAAO,GAAG,GAAG,IAAI,KAAK;AACxB;AAEO,SAAS,eAAe,MAAuD;AACpF,MAAI,CAAC,KAAM,QAAO;AAClB,SAAO,IAAI,KAAK,IAAI,EAAE,eAAe,SAAS;AAAA,IAC5C,KAAK;AAAA,IACL,OAAO;AAAA,IACP,MAAM;AAAA,IACN,MAAM;AAAA,IACN,QAAQ;AAAA,EACV,CAAC;AACH;","names":[]}
|
package/package.json
CHANGED
package/src/infra/utils/date.ts
CHANGED
|
@@ -3,6 +3,9 @@ export function formatShortDate(date: Date | string | null | undefined): string
|
|
|
3
3
|
const d = new Date(date);
|
|
4
4
|
const day = String(d.getDate()).padStart(2, '0');
|
|
5
5
|
const month = String(d.getMonth() + 1).padStart(2, '0');
|
|
6
|
+
if (d.getFullYear() !== new Date().getFullYear()) {
|
|
7
|
+
return `${day}/${month}/${d.getFullYear()}`;
|
|
8
|
+
}
|
|
6
9
|
return `${day}/${month}`;
|
|
7
10
|
}
|
|
8
11
|
|