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.
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Get current time info in local time
3
+ * @author Gabe Abrams
4
+ * @param [dateOrTimestamp=now] the date to get info on or a ms since epoch timestamp
5
+ * @returns object with timestamp (ms since epoch) and numbers
6
+ * corresponding to time values for year, month, day, hour, hour12, minute, isPM
7
+ * where hour is in 24hr time and hour12 is in 12hr time.
8
+ */
9
+ declare const getLocalTimeInfo: (dateOrTimestamp?: number | Date | undefined) => {
10
+ timestamp: number;
11
+ year: number;
12
+ month: number;
13
+ day: number;
14
+ hour: number;
15
+ hour12: number;
16
+ minute: number;
17
+ isPM: boolean;
18
+ };
19
+ export default getLocalTimeInfo;
@@ -2,9 +2,10 @@
2
2
  * Get current time info in US Boston Eastern Time, independent of machine
3
3
  * timezone
4
4
  * @author Gabe Abrams
5
- * @param [date=now] the date to get info on or a ms since epoch timestamp
5
+ * @param [dateOrTimestamp=now] the date to get info on or a ms since epoch timestamp
6
6
  * @returns object with timestamp (ms since epoch) and numbers
7
- * corresponding to ET time values for year, month, day, hour, minute
7
+ * corresponding to ET time values for year, month, day, hour, hour12, minute, isPM
8
+ * where hour is in 24hr time and hour12 is in 12hr time.
8
9
  */
9
10
  declare const getTimeInfoInET: (dateOrTimestamp?: number | Date | undefined) => {
10
11
  timestamp: number;
@@ -12,6 +13,8 @@ declare const getTimeInfoInET: (dateOrTimestamp?: number | Date | undefined) =>
12
13
  month: number;
13
14
  day: number;
14
15
  hour: number;
16
+ hour12: number;
15
17
  minute: number;
18
+ isPM: boolean;
16
19
  };
17
20
  export default getTimeInfoInET;
package/dist/esm/index.js CHANGED
@@ -1295,9 +1295,10 @@ const getOrdinal = (num) => {
1295
1295
  * Get current time info in US Boston Eastern Time, independent of machine
1296
1296
  * timezone
1297
1297
  * @author Gabe Abrams
1298
- * @param [date=now] the date to get info on or a ms since epoch timestamp
1298
+ * @param [dateOrTimestamp=now] the date to get info on or a ms since epoch timestamp
1299
1299
  * @returns object with timestamp (ms since epoch) and numbers
1300
- * corresponding to ET time values for year, month, day, hour, minute
1300
+ * corresponding to ET time values for year, month, day, hour, hour12, minute, isPM
1301
+ * where hour is in 24hr time and hour12 is in 12hr time.
1301
1302
  */
1302
1303
  const getTimeInfoInET = (dateOrTimestamp) => {
1303
1304
  // Create a time string
@@ -1327,14 +1328,15 @@ const getTimeInfoInET = (dateOrTimestamp) => {
1327
1328
  const month = Number.parseInt(monthStr, 10);
1328
1329
  const day = Number.parseInt(dayStr, 10);
1329
1330
  const minute = Number.parseInt(minStr, 10);
1330
- let hour = Number.parseInt(hourStr, 10);
1331
+ let hour12 = Number.parseInt(hourStr, 10);
1331
1332
  // Convert from am/pm to 24hr
1332
1333
  const isAM = ending.toLowerCase().includes('am');
1333
1334
  const isPM = !isAM;
1334
- if (isPM && hour !== 12) {
1335
+ let hour = hour12;
1336
+ if (isPM && hour12 !== 12) {
1335
1337
  hour += 12;
1336
1338
  }
1337
- else if (isAM && hour === 12) {
1339
+ else if (isAM && hour12 === 12) {
1338
1340
  hour = 0;
1339
1341
  }
1340
1342
  // Return
@@ -1344,6 +1346,8 @@ const getTimeInfoInET = (dateOrTimestamp) => {
1344
1346
  month,
1345
1347
  day,
1346
1348
  hour,
1349
+ hour12,
1350
+ isPM,
1347
1351
  minute,
1348
1352
  };
1349
1353
  };