dce-reactkit 3.3.3-beta.1 → 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
@@ -552,15 +552,14 @@ let storedSendRequest;
552
552
  * @returns sendRequest function
553
553
  */
554
554
  const getSendRequest = () => __awaiter(void 0, void 0, void 0, function* () {
555
- // Wait for initialization or timeout
555
+ // Track timeout
556
556
  let timedOut = false;
557
- yield Promise.all([
558
- (() => __awaiter(void 0, void 0, void 0, function* () {
559
- yield waitMs(5000);
560
- timedOut = true;
561
- }))(),
562
- initialized,
563
- ]);
557
+ (() => __awaiter(void 0, void 0, void 0, function* () {
558
+ yield waitMs(5000);
559
+ timedOut = true;
560
+ }))(),
561
+ // Wait for initialization
562
+ yield initialized;
564
563
  // Error if no send request function
565
564
  if (timedOut) {
566
565
  showFatalError(new ErrorWithCode('Could not send a request because the request needed to be sent before dce-reactkit was properly initialized. Perhaps dce-reactkit was not initialized with initClient.', ReactKitErrorCode$1.NoCACCLSendRequestFunction));
@@ -1296,9 +1295,10 @@ const getOrdinal = (num) => {
1296
1295
  * Get current time info in US Boston Eastern Time, independent of machine
1297
1296
  * timezone
1298
1297
  * @author Gabe Abrams
1299
- * @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
1300
1299
  * @returns object with timestamp (ms since epoch) and numbers
1301
- * 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.
1302
1302
  */
1303
1303
  const getTimeInfoInET = (dateOrTimestamp) => {
1304
1304
  // Create a time string
@@ -1328,14 +1328,15 @@ const getTimeInfoInET = (dateOrTimestamp) => {
1328
1328
  const month = Number.parseInt(monthStr, 10);
1329
1329
  const day = Number.parseInt(dayStr, 10);
1330
1330
  const minute = Number.parseInt(minStr, 10);
1331
- let hour = Number.parseInt(hourStr, 10);
1331
+ let hour12 = Number.parseInt(hourStr, 10);
1332
1332
  // Convert from am/pm to 24hr
1333
1333
  const isAM = ending.toLowerCase().includes('am');
1334
1334
  const isPM = !isAM;
1335
- if (isPM && hour !== 12) {
1335
+ let hour = hour12;
1336
+ if (isPM && hour12 !== 12) {
1336
1337
  hour += 12;
1337
1338
  }
1338
- else if (isAM && hour === 12) {
1339
+ else if (isAM && hour12 === 12) {
1339
1340
  hour = 0;
1340
1341
  }
1341
1342
  // Return
@@ -1345,6 +1346,8 @@ const getTimeInfoInET = (dateOrTimestamp) => {
1345
1346
  month,
1346
1347
  day,
1347
1348
  hour,
1349
+ hour12,
1350
+ isPM,
1348
1351
  minute,
1349
1352
  };
1350
1353
  };