sm-utility 2.2.13 → 2.2.14

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/excel/enums.d.ts CHANGED
@@ -1,10 +1,11 @@
1
1
  export declare const enum ExcelFormat {
2
- DATE = "mmm - yy",
2
+ DATE = "MM/YYYY",
3
3
  PERCENTAGE = "0%",
4
4
  MONEY = "R$ 0.00",
5
5
  ZERO_DEFAULT = "0",
6
6
  NUMBER = "123",
7
- FULL_DATE = "dd - mm - yyyy"
7
+ FULL_DATE_BR = "DD/MM/YYYY",
8
+ FULL_DATE_EN = "YYYY/MM/DD"
8
9
  }
9
10
  export declare const enum ExcelType {
10
11
  OPTIONS = "options"
@@ -26,18 +26,25 @@ class ExcelCreatorCustomizer {
26
26
  switch (customFormat) {
27
27
  case "123" /* NUMBER */:
28
28
  return value.toString();
29
- case "mmm - yy" /* DATE */: {
29
+ case "MM/YYYY" /* DATE */: {
30
30
  const date = new Date(value);
31
- const month = date.getMonth();
31
+ const month = (date.getMonth() + 1).toString().padStart(2, '0');
32
+ const year = date.getFullYear();
33
+ return `${month}/${year}`;
34
+ }
35
+ case "DD/MM/YYYY" /* FULL_DATE_BR */: {
36
+ const date = new Date(value);
37
+ const day = date.getDate().toString().padStart(2, '0');
38
+ const month = (date.getMonth() + 1).toString().padStart(2, '0');
32
39
  const year = date.getFullYear();
33
- return `${month} - ${year}`;
40
+ return `${day}/${month}/${year}`;
34
41
  }
35
- case "dd - mm - yyyy" /* FULL_DATE */: {
42
+ case "YYYY/MM/DD" /* FULL_DATE_EN */: {
36
43
  const date = new Date(value);
37
44
  const day = date.getDate().toString().padStart(2, '0');
38
45
  const month = (date.getMonth() + 1).toString().padStart(2, '0');
39
46
  const year = date.getFullYear();
40
- return `${day} - ${month} - ${year}`;
47
+ return `${year}-${month}/${day}`;
41
48
  }
42
49
  case "R$ 0.00" /* MONEY */:
43
50
  return parseFloat(value).toLocaleString("pt-BR", {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sm-utility",
3
- "version": "2.2.13",
3
+ "version": "2.2.14",
4
4
  "description": "reusable utility codes for sm projects",
5
5
  "main": "index.js",
6
6
  "types": "./index.d.ts",