dce-reactkit 3.3.3-beta.2 → 3.3.4
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/cjs/index.js +9 -5
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/helpers/getLocalTimeInfo.d.ts +19 -0
- package/dist/cjs/types/helpers/getTimeInfoInET.d.ts +5 -2
- package/dist/esm/index.js +9 -5
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/helpers/getLocalTimeInfo.d.ts +19 -0
- package/dist/esm/types/helpers/getTimeInfoInET.d.ts +5 -2
- package/dist/index.d.ts +5 -2
- package/package.json +1 -1
- package/src/helpers/getLocalTimeInfo.tsx +55 -0
- package/src/helpers/getTimeInfoInET.tsx +11 -5
package/dist/cjs/index.js
CHANGED
|
@@ -1303,9 +1303,10 @@ const getOrdinal = (num) => {
|
|
|
1303
1303
|
* Get current time info in US Boston Eastern Time, independent of machine
|
|
1304
1304
|
* timezone
|
|
1305
1305
|
* @author Gabe Abrams
|
|
1306
|
-
* @param [
|
|
1306
|
+
* @param [dateOrTimestamp=now] the date to get info on or a ms since epoch timestamp
|
|
1307
1307
|
* @returns object with timestamp (ms since epoch) and numbers
|
|
1308
|
-
* corresponding to ET time values for year, month, day, hour, minute
|
|
1308
|
+
* corresponding to ET time values for year, month, day, hour, hour12, minute, isPM
|
|
1309
|
+
* where hour is in 24hr time and hour12 is in 12hr time.
|
|
1309
1310
|
*/
|
|
1310
1311
|
const getTimeInfoInET = (dateOrTimestamp) => {
|
|
1311
1312
|
// Create a time string
|
|
@@ -1335,14 +1336,15 @@ const getTimeInfoInET = (dateOrTimestamp) => {
|
|
|
1335
1336
|
const month = Number.parseInt(monthStr, 10);
|
|
1336
1337
|
const day = Number.parseInt(dayStr, 10);
|
|
1337
1338
|
const minute = Number.parseInt(minStr, 10);
|
|
1338
|
-
let
|
|
1339
|
+
let hour12 = Number.parseInt(hourStr, 10);
|
|
1339
1340
|
// Convert from am/pm to 24hr
|
|
1340
1341
|
const isAM = ending.toLowerCase().includes('am');
|
|
1341
1342
|
const isPM = !isAM;
|
|
1342
|
-
|
|
1343
|
+
let hour = hour12;
|
|
1344
|
+
if (isPM && hour12 !== 12) {
|
|
1343
1345
|
hour += 12;
|
|
1344
1346
|
}
|
|
1345
|
-
else if (isAM &&
|
|
1347
|
+
else if (isAM && hour12 === 12) {
|
|
1346
1348
|
hour = 0;
|
|
1347
1349
|
}
|
|
1348
1350
|
// Return
|
|
@@ -1352,6 +1354,8 @@ const getTimeInfoInET = (dateOrTimestamp) => {
|
|
|
1352
1354
|
month,
|
|
1353
1355
|
day,
|
|
1354
1356
|
hour,
|
|
1357
|
+
hour12,
|
|
1358
|
+
isPM,
|
|
1355
1359
|
minute,
|
|
1356
1360
|
};
|
|
1357
1361
|
};
|