@fileverse-dev/formulajs 4.4.37 → 4.4.38
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/lib/browser/formula.js +9 -8
- package/lib/browser/formula.min.js +2 -2
- package/lib/browser/formula.min.js.map +1 -1
- package/lib/cjs/index.cjs +20 -8
- package/lib/esm/index.mjs +20 -8
- package/package.json +1 -1
package/lib/cjs/index.cjs
CHANGED
|
@@ -8104,20 +8104,32 @@ const WEEKEND_TYPES = [
|
|
|
8104
8104
|
[6, 6]
|
|
8105
8105
|
];
|
|
8106
8106
|
|
|
8107
|
-
const datePartition = (date) => {
|
|
8107
|
+
const datePartition = (date, utc = false) => {
|
|
8108
8108
|
const pad = (n) => n.toString().padStart(2, "0");
|
|
8109
8109
|
|
|
8110
|
-
const day = pad(date.getUTCDate());
|
|
8111
|
-
const month = pad(
|
|
8112
|
-
|
|
8113
|
-
|
|
8114
|
-
const
|
|
8115
|
-
|
|
8110
|
+
const day = pad(utc ? date.getUTCDate() : date.getDate());
|
|
8111
|
+
const month = pad(
|
|
8112
|
+
(utc ? date.getUTCMonth() : date.getMonth()) + 1
|
|
8113
|
+
);
|
|
8114
|
+
const year = utc
|
|
8115
|
+
? date.getUTCFullYear()
|
|
8116
|
+
: date.getFullYear();
|
|
8117
|
+
|
|
8118
|
+
const hours = pad(
|
|
8119
|
+
utc ? date.getUTCHours() : date.getHours()
|
|
8120
|
+
);
|
|
8121
|
+
const minutes = pad(
|
|
8122
|
+
utc ? date.getUTCMinutes() : date.getMinutes()
|
|
8123
|
+
);
|
|
8124
|
+
const seconds = pad(
|
|
8125
|
+
utc ? date.getUTCSeconds() : date.getSeconds()
|
|
8126
|
+
);
|
|
8116
8127
|
|
|
8117
8128
|
return { day, month, year, hours, minutes, seconds };
|
|
8118
8129
|
};
|
|
8119
8130
|
|
|
8120
8131
|
|
|
8132
|
+
|
|
8121
8133
|
/**
|
|
8122
8134
|
* Returns the serial number of a particular date.
|
|
8123
8135
|
*
|
|
@@ -8471,7 +8483,7 @@ function EPOCHTODATE(timestamp, timeUnit = 1) {
|
|
|
8471
8483
|
|
|
8472
8484
|
const d = new Date(ms);
|
|
8473
8485
|
|
|
8474
|
-
const { day, month, year, hours, minutes, seconds } = datePartition(d);
|
|
8486
|
+
const { day, month, year, hours, minutes, seconds } = datePartition(d, true);
|
|
8475
8487
|
|
|
8476
8488
|
return `${day}/${month}/${year} ${hours}:${minutes}:${seconds}`
|
|
8477
8489
|
}
|
package/lib/esm/index.mjs
CHANGED
|
@@ -8102,20 +8102,32 @@ const WEEKEND_TYPES = [
|
|
|
8102
8102
|
[6, 6]
|
|
8103
8103
|
];
|
|
8104
8104
|
|
|
8105
|
-
const datePartition = (date) => {
|
|
8105
|
+
const datePartition = (date, utc = false) => {
|
|
8106
8106
|
const pad = (n) => n.toString().padStart(2, "0");
|
|
8107
8107
|
|
|
8108
|
-
const day = pad(date.getUTCDate());
|
|
8109
|
-
const month = pad(
|
|
8110
|
-
|
|
8111
|
-
|
|
8112
|
-
const
|
|
8113
|
-
|
|
8108
|
+
const day = pad(utc ? date.getUTCDate() : date.getDate());
|
|
8109
|
+
const month = pad(
|
|
8110
|
+
(utc ? date.getUTCMonth() : date.getMonth()) + 1
|
|
8111
|
+
);
|
|
8112
|
+
const year = utc
|
|
8113
|
+
? date.getUTCFullYear()
|
|
8114
|
+
: date.getFullYear();
|
|
8115
|
+
|
|
8116
|
+
const hours = pad(
|
|
8117
|
+
utc ? date.getUTCHours() : date.getHours()
|
|
8118
|
+
);
|
|
8119
|
+
const minutes = pad(
|
|
8120
|
+
utc ? date.getUTCMinutes() : date.getMinutes()
|
|
8121
|
+
);
|
|
8122
|
+
const seconds = pad(
|
|
8123
|
+
utc ? date.getUTCSeconds() : date.getSeconds()
|
|
8124
|
+
);
|
|
8114
8125
|
|
|
8115
8126
|
return { day, month, year, hours, minutes, seconds };
|
|
8116
8127
|
};
|
|
8117
8128
|
|
|
8118
8129
|
|
|
8130
|
+
|
|
8119
8131
|
/**
|
|
8120
8132
|
* Returns the serial number of a particular date.
|
|
8121
8133
|
*
|
|
@@ -8469,7 +8481,7 @@ function EPOCHTODATE(timestamp, timeUnit = 1) {
|
|
|
8469
8481
|
|
|
8470
8482
|
const d = new Date(ms);
|
|
8471
8483
|
|
|
8472
|
-
const { day, month, year, hours, minutes, seconds } = datePartition(d);
|
|
8484
|
+
const { day, month, year, hours, minutes, seconds } = datePartition(d, true);
|
|
8473
8485
|
|
|
8474
8486
|
return `${day}/${month}/${year} ${hours}:${minutes}:${seconds}`
|
|
8475
8487
|
}
|