dce-reactkit 3.3.3-beta.2 → 3.3.5

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;
@@ -54,6 +54,7 @@ import canReviewLogs from './helpers/canReviewLogs';
54
54
  import isMobileOrTablet from './helpers/isMobileOrTablet';
55
55
  import extractProp from './helpers/extractProp';
56
56
  import compareArraysByProp from './helpers/compareArraysByProp';
57
+ import getLocalTimeInfo from './helpers/getLocalTimeInfo';
57
58
  import ModalButtonType from './types/ModalButtonType';
58
59
  import ModalSize from './types/ModalSize';
59
60
  import ModalType from './types/ModalType';
@@ -69,4 +70,4 @@ import LogBuiltInMetadata from './types/LogBuiltInMetadata';
69
70
  import LogMetadataType from './types/LogMetadataType';
70
71
  import IntelliTableColumn from './types/IntelliTableColumn';
71
72
  import PickableItem from './components/ItemPicker/types/PickableItem';
72
- export { AppWrapper, LoadingSpinner, ErrorBox, Modal, TabBox, RadioButton, CheckboxButton, ButtonInputGroup, SimpleDateChooser, Drawer, PopSuccessMark, PopFailureMark, PopPendingMark, CopiableBox, ItemPicker, LogReviewer, IntelliTable, CSVDownloadButton, alert, confirm, showFatalError, ErrorWithCode, MINUTE_IN_MS, HOUR_IN_MS, DAY_IN_MS, DynamicWord, abbreviate, avg, ceilToNumDecimals, floorToNumDecimals, forceNumIntoBounds, padDecimalZeros, padZerosLeft, roundToNumDecimals, sum, waitMs, getOrdinal, getTimeInfoInET, stubServerEndpoint, startMinWait, getHumanReadableDate, getPartOfDay, stringsToHumanReadableList, onlyKeepLetters, parallelLimit, getMonthName, genCSV, canReviewLogs, isMobileOrTablet, extractProp, compareArraysByProp, initClient, visitServerEndpoint, logClientEvent, initServer, genRouteHandler, handleError, handleSuccess, initLogCollection, ModalButtonType, ModalSize, ModalType, ReactKitErrorCode, Variant, DayOfWeek, Log, LogType, LogSource, LogAction, LogBuiltInMetadata, LogMetadataType, IntelliTableColumn, PickableItem, ParamType, };
73
+ export { AppWrapper, LoadingSpinner, ErrorBox, Modal, TabBox, RadioButton, CheckboxButton, ButtonInputGroup, SimpleDateChooser, Drawer, PopSuccessMark, PopFailureMark, PopPendingMark, CopiableBox, ItemPicker, LogReviewer, IntelliTable, CSVDownloadButton, alert, confirm, showFatalError, ErrorWithCode, MINUTE_IN_MS, HOUR_IN_MS, DAY_IN_MS, DynamicWord, abbreviate, avg, ceilToNumDecimals, floorToNumDecimals, forceNumIntoBounds, padDecimalZeros, padZerosLeft, roundToNumDecimals, sum, waitMs, getOrdinal, getTimeInfoInET, stubServerEndpoint, startMinWait, getHumanReadableDate, getPartOfDay, stringsToHumanReadableList, onlyKeepLetters, parallelLimit, getMonthName, genCSV, canReviewLogs, isMobileOrTablet, extractProp, compareArraysByProp, getLocalTimeInfo, initClient, visitServerEndpoint, logClientEvent, initServer, genRouteHandler, handleError, handleSuccess, initLogCollection, ModalButtonType, ModalSize, ModalType, ReactKitErrorCode, Variant, DayOfWeek, Log, LogType, LogSource, LogAction, LogBuiltInMetadata, LogMetadataType, IntelliTableColumn, PickableItem, ParamType, };
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
  };
@@ -5620,6 +5624,51 @@ const compareArraysByProp = (a, b, prop) => {
5620
5624
  });
5621
5625
  };
5622
5626
 
5627
+ /**
5628
+ * Get current time info in local time
5629
+ * @author Gabe Abrams
5630
+ * @param [dateOrTimestamp=now] the date to get info on or a ms since epoch timestamp
5631
+ * @returns object with timestamp (ms since epoch) and numbers
5632
+ * corresponding to time values for year, month, day, hour, hour12, minute, isPM
5633
+ * where hour is in 24hr time and hour12 is in 12hr time.
5634
+ */
5635
+ const getLocalTimeInfo = (dateOrTimestamp) => {
5636
+ // Create a time string
5637
+ let d;
5638
+ if (!dateOrTimestamp) {
5639
+ // Use now
5640
+ d = new Date();
5641
+ }
5642
+ else if (typeof dateOrTimestamp === 'number') {
5643
+ // Convert to date
5644
+ d = new Date(dateOrTimestamp);
5645
+ }
5646
+ else {
5647
+ // Already a date
5648
+ d = dateOrTimestamp;
5649
+ }
5650
+ // Create all time numbers
5651
+ const timestamp = d.getTime();
5652
+ const year = d.getFullYear();
5653
+ const month = d.getMonth() + 1;
5654
+ const day = d.getDate();
5655
+ const hour = d.getHours();
5656
+ const isPM = hour >= 12;
5657
+ const hour12 = hour % 12;
5658
+ const minute = d.getMinutes();
5659
+ // Return
5660
+ return {
5661
+ timestamp,
5662
+ year,
5663
+ month,
5664
+ day,
5665
+ hour,
5666
+ hour12,
5667
+ isPM,
5668
+ minute,
5669
+ };
5670
+ };
5671
+
5623
5672
  /**
5624
5673
  * Days of the week
5625
5674
  * @author Gabe Abrams
@@ -5636,5 +5685,5 @@ var DayOfWeek;
5636
5685
  })(DayOfWeek || (DayOfWeek = {}));
5637
5686
  var DayOfWeek$1 = DayOfWeek;
5638
5687
 
5639
- export { AppWrapper, ButtonInputGroup, CSVDownloadButton, CheckboxButton, CopiableBox, DAY_IN_MS, DayOfWeek$1 as DayOfWeek, Drawer, DynamicWord, ErrorBox, ErrorWithCode, HOUR_IN_MS, IntelliTable, ItemPicker, LoadingSpinner, LogAction$1 as LogAction, LogBuiltInMetadata, LogReviewer, LogSource$1 as LogSource, LogType$1 as LogType, MINUTE_IN_MS, Modal, ModalButtonType$1 as ModalButtonType, ModalSize$1 as ModalSize, ModalType$1 as ModalType, ParamType$1 as ParamType, PopFailureMark, PopPendingMark, PopSuccessMark, RadioButton, ReactKitErrorCode$1 as ReactKitErrorCode, SimpleDateChooser, TabBox, Variant$1 as Variant, abbreviate, alert$1 as alert, avg, canReviewLogs, ceilToNumDecimals, compareArraysByProp, confirm, extractProp, floorToNumDecimals, forceNumIntoBounds, genCSV, genRouteHandler, getHumanReadableDate, getMonthName, getOrdinal, getPartOfDay, getTimeInfoInET, handleError, handleSuccess, initClient, initLogCollection, initServer, isMobileOrTablet, logClientEvent, onlyKeepLetters, padDecimalZeros, padZerosLeft, parallelLimit, roundToNumDecimals, showFatalError, startMinWait, stringsToHumanReadableList, stubServerEndpoint, sum, visitServerEndpoint, waitMs };
5688
+ export { AppWrapper, ButtonInputGroup, CSVDownloadButton, CheckboxButton, CopiableBox, DAY_IN_MS, DayOfWeek$1 as DayOfWeek, Drawer, DynamicWord, ErrorBox, ErrorWithCode, HOUR_IN_MS, IntelliTable, ItemPicker, LoadingSpinner, LogAction$1 as LogAction, LogBuiltInMetadata, LogReviewer, LogSource$1 as LogSource, LogType$1 as LogType, MINUTE_IN_MS, Modal, ModalButtonType$1 as ModalButtonType, ModalSize$1 as ModalSize, ModalType$1 as ModalType, ParamType$1 as ParamType, PopFailureMark, PopPendingMark, PopSuccessMark, RadioButton, ReactKitErrorCode$1 as ReactKitErrorCode, SimpleDateChooser, TabBox, Variant$1 as Variant, abbreviate, alert$1 as alert, avg, canReviewLogs, ceilToNumDecimals, compareArraysByProp, confirm, extractProp, floorToNumDecimals, forceNumIntoBounds, genCSV, genRouteHandler, getHumanReadableDate, getLocalTimeInfo, getMonthName, getOrdinal, getPartOfDay, getTimeInfoInET, handleError, handleSuccess, initClient, initLogCollection, initServer, isMobileOrTablet, logClientEvent, onlyKeepLetters, padDecimalZeros, padZerosLeft, parallelLimit, roundToNumDecimals, showFatalError, startMinWait, stringsToHumanReadableList, stubServerEndpoint, sum, visitServerEndpoint, waitMs };
5640
5689
  //# sourceMappingURL=index.js.map