dce-reactkit 4.3.5-beta-progress-size.2 → 5.0.0
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 +405 -2374
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/components/LogReviewer.d.ts +1 -1
- package/dist/cjs/types/helpers/logClientEvent.d.ts +1 -1
- package/dist/cjs/types/html/genErrorPage.d.ts +1 -1
- package/dist/cjs/types/index.d.ts +2 -64
- package/dist/cjs/types/types/IntelliTableColumn.d.ts +1 -1
- package/dist/cjs/types/types/ProgressBarSize.d.ts +1 -0
- package/dist/esm/index.js +145 -2281
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/components/LogReviewer.d.ts +1 -1
- package/dist/esm/types/helpers/logClientEvent.d.ts +1 -1
- package/dist/esm/types/html/genErrorPage.d.ts +1 -1
- package/dist/esm/types/index.d.ts +2 -64
- package/dist/esm/types/types/IntelliTableColumn.d.ts +1 -1
- package/dist/esm/types/types/ProgressBarSize.d.ts +1 -0
- package/dist/index.d.ts +4 -835
- package/package.json +4 -3
- package/src/components/AppWrapper.tsx +12 -10
- package/src/components/AutoscrollToBottomContainer.tsx +5 -3
- package/src/components/CopiableBox.tsx +5 -1
- package/src/components/DBEntryManagerPanel/helpers/generateEndpointPath.ts +2 -2
- package/src/components/ErrorBox.tsx +6 -2
- package/src/components/IntelliTable.tsx +7 -5
- package/src/components/LogReviewer.tsx +23 -21
- package/src/components/Modal/index.tsx +5 -3
- package/src/components/MultiSwitch.tsx +5 -1
- package/src/components/ProgressBar.tsx +75 -61
- package/src/components/Shimmer.tsx +4 -2
- package/src/components/SimpleDateChooser.tsx +11 -13
- package/src/components/SimpleTimeChooser.tsx +4 -2
- package/src/helpers/canReviewLogs.test.ts +5 -3
- package/src/helpers/canReviewLogs.ts +5 -3
- package/src/helpers/initClient.tsx +8 -8
- package/src/helpers/isMobileOrTablet.tsx +2 -1
- package/src/helpers/isSelectAdmin.ts +4 -2
- package/src/helpers/logClientEvent.tsx +7 -5
- package/src/helpers/stubServerEndpoint.tsx +1 -1
- package/src/helpers/visitServerEndpoint.tsx +10 -7
- package/src/html/genErrorPage.ts +6 -4
- package/src/index.ts +105 -98
- package/src/types/IntelliTableColumn.ts +4 -1
- package/src/types/ProgressBarSize.ts +1 -0
- package/dist/cjs/types/constants/DAY_IN_MS.d.ts +0 -6
- package/dist/cjs/types/constants/HOUR_IN_MS.d.ts +0 -6
- package/dist/cjs/types/constants/LOG_REVIEW_GET_LOGS_ROUTE.d.ts +0 -6
- package/dist/cjs/types/constants/LOG_REVIEW_ROUTE_PATH_PREFIX.d.ts +0 -6
- package/dist/cjs/types/constants/LOG_REVIEW_STATUS_ROUTE.d.ts +0 -7
- package/dist/cjs/types/constants/LOG_ROUTE_PATH.d.ts +0 -6
- package/dist/cjs/types/constants/MINUTE_IN_MS.d.ts +0 -6
- package/dist/cjs/types/constants/ROUTE_PATH_PREFIX.d.ts +0 -6
- package/dist/cjs/types/constants/SELECT_ADMIN_CHECK_ROUTE.d.ts +0 -6
- package/dist/cjs/types/errors/ErrorWithCode.d.ts +0 -9
- package/dist/cjs/types/helpers/abbreviate.d.ts +0 -10
- package/dist/cjs/types/helpers/abbreviate.test.d.ts +0 -5
- package/dist/cjs/types/helpers/asyncArrayFunctions/everyAsync.d.ts +0 -13
- package/dist/cjs/types/helpers/asyncArrayFunctions/everyAsync.test.d.ts +0 -1
- package/dist/cjs/types/helpers/asyncArrayFunctions/filterAsync.d.ts +0 -13
- package/dist/cjs/types/helpers/asyncArrayFunctions/filterAsync.test.d.ts +0 -1
- package/dist/cjs/types/helpers/asyncArrayFunctions/forEachAsync.d.ts +0 -10
- package/dist/cjs/types/helpers/asyncArrayFunctions/forEachAsync.test.d.ts +0 -1
- package/dist/cjs/types/helpers/asyncArrayFunctions/mapAsync.d.ts +0 -11
- package/dist/cjs/types/helpers/asyncArrayFunctions/mapAsync.test.d.ts +0 -1
- package/dist/cjs/types/helpers/asyncArrayFunctions/someAsync.d.ts +0 -13
- package/dist/cjs/types/helpers/asyncArrayFunctions/someAsync.test.d.ts +0 -1
- package/dist/cjs/types/helpers/avg.d.ts +0 -8
- package/dist/cjs/types/helpers/avg.test.d.ts +0 -5
- package/dist/cjs/types/helpers/capitalize.d.ts +0 -7
- package/dist/cjs/types/helpers/ceilToNumDecimals.d.ts +0 -9
- package/dist/cjs/types/helpers/ceilToNumDecimals.test.d.ts +0 -5
- package/dist/cjs/types/helpers/cloneDeep.d.ts +0 -8
- package/dist/cjs/types/helpers/compareArraysByProp.d.ts +0 -13
- package/dist/cjs/types/helpers/compareArraysByProp.test.d.ts +0 -5
- package/dist/cjs/types/helpers/extractProp.d.ts +0 -12
- package/dist/cjs/types/helpers/extractProp.test.d.ts +0 -5
- package/dist/cjs/types/helpers/floorToNumDecimals.d.ts +0 -9
- package/dist/cjs/types/helpers/floorToNumDecimals.test.d.ts +0 -5
- package/dist/cjs/types/helpers/forceNumIntoBounds.d.ts +0 -10
- package/dist/cjs/types/helpers/forceNumIntoBounds.test.d.ts +0 -5
- package/dist/cjs/types/helpers/genCSV.d.ts +0 -18
- package/dist/cjs/types/helpers/genCSV.test.d.ts +0 -5
- package/dist/cjs/types/helpers/genCommaList.d.ts +0 -12
- package/dist/cjs/types/helpers/genCommaList.test.d.ts +0 -1
- package/dist/cjs/types/helpers/getHumanReadableDate.d.ts +0 -8
- package/dist/cjs/types/helpers/getHumanReadableDate.test.d.ts +0 -5
- package/dist/cjs/types/helpers/getLocalTimeInfo.d.ts +0 -19
- package/dist/cjs/types/helpers/getLocalTimeInfo.test.d.ts +0 -6
- package/dist/cjs/types/helpers/getMonthName.d.ts +0 -14
- package/dist/cjs/types/helpers/getMonthName.test.d.ts +0 -5
- package/dist/cjs/types/helpers/getOrdinal.d.ts +0 -8
- package/dist/cjs/types/helpers/getOrdinal.test.d.ts +0 -5
- package/dist/cjs/types/helpers/getPartOfDay.d.ts +0 -7
- package/dist/cjs/types/helpers/getPartOfDay.test.d.ts +0 -5
- package/dist/cjs/types/helpers/getTimeInfoInET.d.ts +0 -21
- package/dist/cjs/types/helpers/getTimeInfoInET.test.d.ts +0 -5
- package/dist/cjs/types/helpers/getTimestampFromTimeInfoInET.d.ts +0 -20
- package/dist/cjs/types/helpers/getWordCount.d.ts +0 -10
- package/dist/cjs/types/helpers/idify.d.ts +0 -9
- package/dist/cjs/types/helpers/onlyKeepLetters.d.ts +0 -8
- package/dist/cjs/types/helpers/padDecimalZeros.d.ts +0 -10
- package/dist/cjs/types/helpers/padZerosLeft.d.ts +0 -9
- package/dist/cjs/types/helpers/parallelLimit.d.ts +0 -12
- package/dist/cjs/types/helpers/prefixWithAOrAn.d.ts +0 -10
- package/dist/cjs/types/helpers/roundToNumDecimals.d.ts +0 -9
- package/dist/cjs/types/helpers/shuffleArray.d.ts +0 -8
- package/dist/cjs/types/helpers/startMinWait.d.ts +0 -9
- package/dist/cjs/types/helpers/stringsToHumanReadableList.d.ts +0 -10
- package/dist/cjs/types/helpers/sum.d.ts +0 -8
- package/dist/cjs/types/helpers/validators/ChicagoTitleCase.d.ts +0 -9
- package/dist/cjs/types/helpers/validators/shared/constants/ERROR_MESSAGES.d.ts +0 -10
- package/dist/cjs/types/helpers/validators/shared/helpers/validateRegex.d.ts +0 -19
- package/dist/cjs/types/helpers/validators/shared/types/ValidationResult.d.ts +0 -12
- package/dist/cjs/types/helpers/validators/validURL.d.ts +0 -8
- package/dist/cjs/types/helpers/validators/validateEmail.d.ts +0 -11
- package/dist/cjs/types/helpers/validators/validateEmail.test.d.ts +0 -1
- package/dist/cjs/types/helpers/validators/validatePhoneNumber.d.ts +0 -11
- package/dist/cjs/types/helpers/validators/validatePhoneNumber.test.d.ts +0 -1
- package/dist/cjs/types/helpers/validators/validateString.d.ts +0 -22
- package/dist/cjs/types/helpers/validators/validateString.test.d.ts +0 -1
- package/dist/cjs/types/helpers/waitMs.d.ts +0 -7
- package/dist/cjs/types/types/DayOfWeek.d.ts +0 -14
- package/dist/cjs/types/types/Log/LogMainInfo.d.ts +0 -39
- package/dist/cjs/types/types/Log/LogSourceSpecificInfo.d.ts +0 -13
- package/dist/cjs/types/types/Log/LogTypeSpecificInfo.d.ts +0 -17
- package/dist/cjs/types/types/Log/index.d.ts +0 -10
- package/dist/cjs/types/types/LogAction.d.ts +0 -29
- package/dist/cjs/types/types/LogBuiltInMetadata.d.ts +0 -16
- package/dist/cjs/types/types/LogFunction.d.ts +0 -24
- package/dist/cjs/types/types/LogLevel.d.ts +0 -10
- package/dist/cjs/types/types/LogMetadataContextMap.d.ts +0 -11
- package/dist/cjs/types/types/LogMetadataTagMap.d.ts +0 -8
- package/dist/cjs/types/types/LogMetadataTargetMap.d.ts +0 -8
- package/dist/cjs/types/types/LogMetadataType.d.ts +0 -13
- package/dist/cjs/types/types/LogReviewerFilterState/ActionErrorFilterState.d.ts +0 -17
- package/dist/cjs/types/types/LogReviewerFilterState/AdvancedFilterState.d.ts +0 -21
- package/dist/cjs/types/types/LogReviewerFilterState/ContextFilterState.d.ts +0 -10
- package/dist/cjs/types/types/LogReviewerFilterState/DateFilterState.d.ts +0 -17
- package/dist/cjs/types/types/LogReviewerFilterState/TagFilterState.d.ts +0 -8
- package/dist/cjs/types/types/LogReviewerFilterState/index.d.ts +0 -17
- package/dist/cjs/types/types/LogSource.d.ts +0 -9
- package/dist/cjs/types/types/LogType.d.ts +0 -9
- package/dist/cjs/types/types/ParamType.d.ts +0 -17
- package/dist/cjs/types/types/ReactKitErrorCode.d.ts +0 -14
- package/dist/esm/types/constants/DAY_IN_MS.d.ts +0 -6
- package/dist/esm/types/constants/HOUR_IN_MS.d.ts +0 -6
- package/dist/esm/types/constants/LOG_REVIEW_GET_LOGS_ROUTE.d.ts +0 -6
- package/dist/esm/types/constants/LOG_REVIEW_ROUTE_PATH_PREFIX.d.ts +0 -6
- package/dist/esm/types/constants/LOG_REVIEW_STATUS_ROUTE.d.ts +0 -7
- package/dist/esm/types/constants/LOG_ROUTE_PATH.d.ts +0 -6
- package/dist/esm/types/constants/MINUTE_IN_MS.d.ts +0 -6
- package/dist/esm/types/constants/ROUTE_PATH_PREFIX.d.ts +0 -6
- package/dist/esm/types/constants/SELECT_ADMIN_CHECK_ROUTE.d.ts +0 -6
- package/dist/esm/types/errors/ErrorWithCode.d.ts +0 -9
- package/dist/esm/types/helpers/abbreviate.d.ts +0 -10
- package/dist/esm/types/helpers/abbreviate.test.d.ts +0 -5
- package/dist/esm/types/helpers/asyncArrayFunctions/everyAsync.d.ts +0 -13
- package/dist/esm/types/helpers/asyncArrayFunctions/everyAsync.test.d.ts +0 -1
- package/dist/esm/types/helpers/asyncArrayFunctions/filterAsync.d.ts +0 -13
- package/dist/esm/types/helpers/asyncArrayFunctions/filterAsync.test.d.ts +0 -1
- package/dist/esm/types/helpers/asyncArrayFunctions/forEachAsync.d.ts +0 -10
- package/dist/esm/types/helpers/asyncArrayFunctions/forEachAsync.test.d.ts +0 -1
- package/dist/esm/types/helpers/asyncArrayFunctions/mapAsync.d.ts +0 -11
- package/dist/esm/types/helpers/asyncArrayFunctions/mapAsync.test.d.ts +0 -1
- package/dist/esm/types/helpers/asyncArrayFunctions/someAsync.d.ts +0 -13
- package/dist/esm/types/helpers/asyncArrayFunctions/someAsync.test.d.ts +0 -1
- package/dist/esm/types/helpers/avg.d.ts +0 -8
- package/dist/esm/types/helpers/avg.test.d.ts +0 -5
- package/dist/esm/types/helpers/capitalize.d.ts +0 -7
- package/dist/esm/types/helpers/ceilToNumDecimals.d.ts +0 -9
- package/dist/esm/types/helpers/ceilToNumDecimals.test.d.ts +0 -5
- package/dist/esm/types/helpers/cloneDeep.d.ts +0 -8
- package/dist/esm/types/helpers/compareArraysByProp.d.ts +0 -13
- package/dist/esm/types/helpers/compareArraysByProp.test.d.ts +0 -5
- package/dist/esm/types/helpers/extractProp.d.ts +0 -12
- package/dist/esm/types/helpers/extractProp.test.d.ts +0 -5
- package/dist/esm/types/helpers/floorToNumDecimals.d.ts +0 -9
- package/dist/esm/types/helpers/floorToNumDecimals.test.d.ts +0 -5
- package/dist/esm/types/helpers/forceNumIntoBounds.d.ts +0 -10
- package/dist/esm/types/helpers/forceNumIntoBounds.test.d.ts +0 -5
- package/dist/esm/types/helpers/genCSV.d.ts +0 -18
- package/dist/esm/types/helpers/genCSV.test.d.ts +0 -5
- package/dist/esm/types/helpers/genCommaList.d.ts +0 -12
- package/dist/esm/types/helpers/genCommaList.test.d.ts +0 -1
- package/dist/esm/types/helpers/getHumanReadableDate.d.ts +0 -8
- package/dist/esm/types/helpers/getHumanReadableDate.test.d.ts +0 -5
- package/dist/esm/types/helpers/getLocalTimeInfo.d.ts +0 -19
- package/dist/esm/types/helpers/getLocalTimeInfo.test.d.ts +0 -6
- package/dist/esm/types/helpers/getMonthName.d.ts +0 -14
- package/dist/esm/types/helpers/getMonthName.test.d.ts +0 -5
- package/dist/esm/types/helpers/getOrdinal.d.ts +0 -8
- package/dist/esm/types/helpers/getOrdinal.test.d.ts +0 -5
- package/dist/esm/types/helpers/getPartOfDay.d.ts +0 -7
- package/dist/esm/types/helpers/getPartOfDay.test.d.ts +0 -5
- package/dist/esm/types/helpers/getTimeInfoInET.d.ts +0 -21
- package/dist/esm/types/helpers/getTimeInfoInET.test.d.ts +0 -5
- package/dist/esm/types/helpers/getTimestampFromTimeInfoInET.d.ts +0 -20
- package/dist/esm/types/helpers/getWordCount.d.ts +0 -10
- package/dist/esm/types/helpers/idify.d.ts +0 -9
- package/dist/esm/types/helpers/onlyKeepLetters.d.ts +0 -8
- package/dist/esm/types/helpers/padDecimalZeros.d.ts +0 -10
- package/dist/esm/types/helpers/padZerosLeft.d.ts +0 -9
- package/dist/esm/types/helpers/parallelLimit.d.ts +0 -12
- package/dist/esm/types/helpers/prefixWithAOrAn.d.ts +0 -10
- package/dist/esm/types/helpers/roundToNumDecimals.d.ts +0 -9
- package/dist/esm/types/helpers/shuffleArray.d.ts +0 -8
- package/dist/esm/types/helpers/startMinWait.d.ts +0 -9
- package/dist/esm/types/helpers/stringsToHumanReadableList.d.ts +0 -10
- package/dist/esm/types/helpers/sum.d.ts +0 -8
- package/dist/esm/types/helpers/validators/ChicagoTitleCase.d.ts +0 -9
- package/dist/esm/types/helpers/validators/shared/constants/ERROR_MESSAGES.d.ts +0 -10
- package/dist/esm/types/helpers/validators/shared/helpers/validateRegex.d.ts +0 -19
- package/dist/esm/types/helpers/validators/shared/types/ValidationResult.d.ts +0 -12
- package/dist/esm/types/helpers/validators/validURL.d.ts +0 -8
- package/dist/esm/types/helpers/validators/validateEmail.d.ts +0 -11
- package/dist/esm/types/helpers/validators/validateEmail.test.d.ts +0 -1
- package/dist/esm/types/helpers/validators/validatePhoneNumber.d.ts +0 -11
- package/dist/esm/types/helpers/validators/validatePhoneNumber.test.d.ts +0 -1
- package/dist/esm/types/helpers/validators/validateString.d.ts +0 -22
- package/dist/esm/types/helpers/validators/validateString.test.d.ts +0 -1
- package/dist/esm/types/helpers/waitMs.d.ts +0 -7
- package/dist/esm/types/types/DayOfWeek.d.ts +0 -14
- package/dist/esm/types/types/Log/LogMainInfo.d.ts +0 -39
- package/dist/esm/types/types/Log/LogSourceSpecificInfo.d.ts +0 -13
- package/dist/esm/types/types/Log/LogTypeSpecificInfo.d.ts +0 -17
- package/dist/esm/types/types/Log/index.d.ts +0 -10
- package/dist/esm/types/types/LogAction.d.ts +0 -29
- package/dist/esm/types/types/LogBuiltInMetadata.d.ts +0 -16
- package/dist/esm/types/types/LogFunction.d.ts +0 -24
- package/dist/esm/types/types/LogLevel.d.ts +0 -10
- package/dist/esm/types/types/LogMetadataContextMap.d.ts +0 -11
- package/dist/esm/types/types/LogMetadataTagMap.d.ts +0 -8
- package/dist/esm/types/types/LogMetadataTargetMap.d.ts +0 -8
- package/dist/esm/types/types/LogMetadataType.d.ts +0 -13
- package/dist/esm/types/types/LogReviewerFilterState/ActionErrorFilterState.d.ts +0 -17
- package/dist/esm/types/types/LogReviewerFilterState/AdvancedFilterState.d.ts +0 -21
- package/dist/esm/types/types/LogReviewerFilterState/ContextFilterState.d.ts +0 -10
- package/dist/esm/types/types/LogReviewerFilterState/DateFilterState.d.ts +0 -17
- package/dist/esm/types/types/LogReviewerFilterState/TagFilterState.d.ts +0 -8
- package/dist/esm/types/types/LogReviewerFilterState/index.d.ts +0 -17
- package/dist/esm/types/types/LogSource.d.ts +0 -9
- package/dist/esm/types/types/LogType.d.ts +0 -9
- package/dist/esm/types/types/ParamType.d.ts +0 -17
- package/dist/esm/types/types/ReactKitErrorCode.d.ts +0 -14
- package/src/constants/DAY_IN_MS.ts +0 -7
- package/src/constants/HOUR_IN_MS.ts +0 -7
- package/src/constants/LOG_REVIEW_GET_LOGS_ROUTE.ts +0 -9
- package/src/constants/LOG_REVIEW_ROUTE_PATH_PREFIX.ts +0 -9
- package/src/constants/LOG_REVIEW_STATUS_ROUTE.ts +0 -10
- package/src/constants/LOG_ROUTE_PATH.ts +0 -9
- package/src/constants/MINUTE_IN_MS.ts +0 -7
- package/src/constants/ROUTE_PATH_PREFIX.ts +0 -7
- package/src/constants/SELECT_ADMIN_CHECK_ROUTE.ts +0 -7
- package/src/errors/ErrorWithCode.tsx +0 -15
- package/src/helpers/abbreviate.test.ts +0 -26
- package/src/helpers/abbreviate.ts +0 -25
- package/src/helpers/asyncArrayFunctions/everyAsync.test.ts +0 -114
- package/src/helpers/asyncArrayFunctions/everyAsync.ts +0 -51
- package/src/helpers/asyncArrayFunctions/filterAsync.test.ts +0 -126
- package/src/helpers/asyncArrayFunctions/filterAsync.ts +0 -50
- package/src/helpers/asyncArrayFunctions/forEachAsync.test.ts +0 -136
- package/src/helpers/asyncArrayFunctions/forEachAsync.ts +0 -40
- package/src/helpers/asyncArrayFunctions/mapAsync.test.ts +0 -125
- package/src/helpers/asyncArrayFunctions/mapAsync.ts +0 -46
- package/src/helpers/asyncArrayFunctions/someAsync.test.ts +0 -92
- package/src/helpers/asyncArrayFunctions/someAsync.ts +0 -49
- package/src/helpers/avg.test.ts +0 -24
- package/src/helpers/avg.ts +0 -22
- package/src/helpers/capitalize.ts +0 -20
- package/src/helpers/ceilToNumDecimals.test.ts +0 -39
- package/src/helpers/ceilToNumDecimals.ts +0 -13
- package/src/helpers/cloneDeep.ts +0 -11
- package/src/helpers/compareArraysByProp.test.ts +0 -147
- package/src/helpers/compareArraysByProp.ts +0 -56
- package/src/helpers/extractProp.test.ts +0 -34
- package/src/helpers/extractProp.ts +0 -17
- package/src/helpers/floorToNumDecimals.test.ts +0 -39
- package/src/helpers/floorToNumDecimals.ts +0 -13
- package/src/helpers/forceNumIntoBounds.test.ts +0 -34
- package/src/helpers/forceNumIntoBounds.ts +0 -19
- package/src/helpers/genCSV.test.ts +0 -75
- package/src/helpers/genCSV.ts +0 -87
- package/src/helpers/genCommaList.test.ts +0 -57
- package/src/helpers/genCommaList.ts +0 -21
- package/src/helpers/getHumanReadableDate.test.ts +0 -29
- package/src/helpers/getHumanReadableDate.ts +0 -36
- package/src/helpers/getLocalTimeInfo.test.ts +0 -48
- package/src/helpers/getLocalTimeInfo.ts +0 -58
- package/src/helpers/getMonthName.test.ts +0 -79
- package/src/helpers/getMonthName.ts +0 -29
- package/src/helpers/getOrdinal.test.ts +0 -84
- package/src/helpers/getOrdinal.ts +0 -14
- package/src/helpers/getPartOfDay.test.ts +0 -56
- package/src/helpers/getPartOfDay.ts +0 -20
- package/src/helpers/getTimeInfoInET.test.ts +0 -72
- package/src/helpers/getTimeInfoInET.ts +0 -79
- package/src/helpers/getTimestampFromTimeInfoInET.ts +0 -179
- package/src/helpers/getWordCount.ts +0 -26
- package/src/helpers/idify.ts +0 -24
- package/src/helpers/onlyKeepLetters.ts +0 -11
- package/src/helpers/padDecimalZeros.tsx +0 -32
- package/src/helpers/padZerosLeft.tsx +0 -21
- package/src/helpers/parallelLimit.ts +0 -76
- package/src/helpers/prefixWithAOrAn.ts +0 -29
- package/src/helpers/roundToNumDecimals.tsx +0 -13
- package/src/helpers/shuffleArray.ts +0 -19
- package/src/helpers/startMinWait.ts +0 -33
- package/src/helpers/stringsToHumanReadableList.ts +0 -39
- package/src/helpers/sum.tsx +0 -16
- package/src/helpers/validators/ChicagoTitleCase.test.ts +0 -85
- package/src/helpers/validators/ChicagoTitleCase.ts +0 -32
- package/src/helpers/validators/findURL.test.ts +0 -83
- package/src/helpers/validators/findURL.ts +0 -43
- package/src/helpers/validators/shared/constants/ERROR_MESSAGES.ts +0 -18
- package/src/helpers/validators/shared/helpers/validateRegex.ts +0 -47
- package/src/helpers/validators/shared/types/ValidationResult.ts +0 -20
- package/src/helpers/validators/validURL.test.ts +0 -90
- package/src/helpers/validators/validURL.ts +0 -18
- package/src/helpers/validators/validateEmail.test.ts +0 -110
- package/src/helpers/validators/validateEmail.ts +0 -47
- package/src/helpers/validators/validatePhoneNumber.test.ts +0 -94
- package/src/helpers/validators/validatePhoneNumber.ts +0 -49
- package/src/helpers/validators/validateString.test.ts +0 -173
- package/src/helpers/validators/validateString.ts +0 -171
- package/src/helpers/waitMs.tsx +0 -12
- package/src/types/DayOfWeek.ts +0 -15
- package/src/types/Log/LogMainInfo.ts +0 -69
- package/src/types/Log/LogSourceSpecificInfo.ts +0 -25
- package/src/types/Log/LogTypeSpecificInfo.ts +0 -33
- package/src/types/Log/index.ts +0 -17
- package/src/types/LogAction.ts +0 -52
- package/src/types/LogBuiltInMetadata.ts +0 -19
- package/src/types/LogFunction.ts +0 -46
- package/src/types/LogLevel.ts +0 -11
- package/src/types/LogMetadataContextMap.ts +0 -15
- package/src/types/LogMetadataTagMap.ts +0 -9
- package/src/types/LogMetadataTargetMap.ts +0 -9
- package/src/types/LogMetadataType.ts +0 -16
- package/src/types/LogReviewerFilterState/ActionErrorFilterState.ts +0 -24
- package/src/types/LogReviewerFilterState/AdvancedFilterState.ts +0 -36
- package/src/types/LogReviewerFilterState/ContextFilterState.ts +0 -16
- package/src/types/LogReviewerFilterState/DateFilterState.ts +0 -26
- package/src/types/LogReviewerFilterState/TagFilterState.ts +0 -9
- package/src/types/LogReviewerFilterState/index.ts +0 -24
- package/src/types/LogSource.ts +0 -12
- package/src/types/LogType.ts +0 -12
- package/src/types/ParamType.ts +0 -18
- package/src/types/ReactKitErrorCode.tsx +0 -17
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Test for getLocalTimeInfo helper function
|
|
3
|
-
* NOTE: only works if this test is run on a machine in ET
|
|
4
|
-
* @author Gabe Abrams
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
// Import main function
|
|
8
|
-
import getLocalTimeInfo from './getLocalTimeInfo';
|
|
9
|
-
|
|
10
|
-
describe('getLocalTimeInfo', () => {
|
|
11
|
-
it('should return current time info if no argument is passed', () => {
|
|
12
|
-
const result = getLocalTimeInfo();
|
|
13
|
-
const now = new Date();
|
|
14
|
-
expect(result.timestamp).toBeCloseTo(now.getTime(), -3);
|
|
15
|
-
expect(result.year).toEqual(now.getFullYear());
|
|
16
|
-
expect(result.month).toEqual(now.getMonth() + 1);
|
|
17
|
-
expect(result.day).toEqual(now.getDate());
|
|
18
|
-
expect(result.hour).toEqual(now.getHours());
|
|
19
|
-
expect(result.minute).toEqual(now.getMinutes());
|
|
20
|
-
expect(result.isPM).toEqual(now.getHours() >= 12);
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
it('should return correct time info for a given timestamp', () => {
|
|
24
|
-
const timestamp = 1629822000000; // 2021-08-24T12:20:00.000Z
|
|
25
|
-
const result = getLocalTimeInfo(timestamp);
|
|
26
|
-
expect(result.timestamp).toEqual(timestamp);
|
|
27
|
-
expect(result.year).toEqual(2021);
|
|
28
|
-
expect(result.month).toEqual(8);
|
|
29
|
-
expect(result.day).toEqual(24);
|
|
30
|
-
expect(result.hour).toEqual(12);
|
|
31
|
-
expect(result.hour12).toEqual(12);
|
|
32
|
-
expect(result.minute).toEqual(20);
|
|
33
|
-
expect(result.isPM).toEqual(true);
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
it('should return correct time info for a given Date object', () => {
|
|
37
|
-
const date = new Date('2021-08-24T12:20:00.000Z');
|
|
38
|
-
const result = getLocalTimeInfo(date);
|
|
39
|
-
expect(result.timestamp).toEqual(date.getTime());
|
|
40
|
-
expect(result.year).toEqual(2021);
|
|
41
|
-
expect(result.month).toEqual(8);
|
|
42
|
-
expect(result.day).toEqual(24);
|
|
43
|
-
expect(result.hour).toEqual(8);
|
|
44
|
-
expect(result.hour12).toEqual(8);
|
|
45
|
-
expect(result.minute).toEqual(20);
|
|
46
|
-
expect(result.isPM).toEqual(false);
|
|
47
|
-
});
|
|
48
|
-
});
|
|
@@ -1,58 +0,0 @@
|
|
|
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
|
-
const getLocalTimeInfo = (dateOrTimestamp?: Date | number): {
|
|
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
|
-
// Create a time string
|
|
20
|
-
let d: Date;
|
|
21
|
-
if (!dateOrTimestamp) {
|
|
22
|
-
// Use now
|
|
23
|
-
d = new Date();
|
|
24
|
-
} else if (typeof dateOrTimestamp === 'number') {
|
|
25
|
-
// Convert to date
|
|
26
|
-
d = new Date(dateOrTimestamp);
|
|
27
|
-
} else {
|
|
28
|
-
// Already a date
|
|
29
|
-
d = dateOrTimestamp;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
// Create all time numbers
|
|
33
|
-
const timestamp = d.getTime();
|
|
34
|
-
const year = d.getFullYear();
|
|
35
|
-
const month = d.getMonth() + 1;
|
|
36
|
-
const day = d.getDate();
|
|
37
|
-
const hour = d.getHours();
|
|
38
|
-
const isPM = hour >= 12;
|
|
39
|
-
let hour12 = hour % 12;
|
|
40
|
-
if (hour12 === 0) {
|
|
41
|
-
hour12 = 12;
|
|
42
|
-
}
|
|
43
|
-
const minute = d.getMinutes();
|
|
44
|
-
|
|
45
|
-
// Return
|
|
46
|
-
return {
|
|
47
|
-
timestamp,
|
|
48
|
-
year,
|
|
49
|
-
month,
|
|
50
|
-
day,
|
|
51
|
-
hour,
|
|
52
|
-
hour12,
|
|
53
|
-
isPM,
|
|
54
|
-
minute,
|
|
55
|
-
};
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
export default getLocalTimeInfo;
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Test for getMonthName helper
|
|
3
|
-
* @author Gabe Abrams
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
// Import main helper
|
|
7
|
-
import getMonthName from './getMonthName';
|
|
8
|
-
|
|
9
|
-
describe('getMonthName', () => {
|
|
10
|
-
it('should return January for 1', () => {
|
|
11
|
-
const result = getMonthName(1);
|
|
12
|
-
expect(result).toEqual({ short: 'Jan', full: 'January' });
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
it('should return February for 2', () => {
|
|
16
|
-
const result = getMonthName(2);
|
|
17
|
-
expect(result).toEqual({ short: 'Feb', full: 'February' });
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
it('should return March for 3', () => {
|
|
21
|
-
const result = getMonthName(3);
|
|
22
|
-
expect(result).toEqual({ short: 'Mar', full: 'March' });
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
it('should return April for 4', () => {
|
|
26
|
-
const result = getMonthName(4);
|
|
27
|
-
expect(result).toEqual({ short: 'Apr', full: 'April' });
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
it('should return May for 5', () => {
|
|
31
|
-
const result = getMonthName(5);
|
|
32
|
-
expect(result).toEqual({ short: 'May', full: 'May' });
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
it('should return June for 6', () => {
|
|
36
|
-
const result = getMonthName(6);
|
|
37
|
-
expect(result).toEqual({ short: 'Jun', full: 'June' });
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
it('should return July for 7', () => {
|
|
41
|
-
const result = getMonthName(7);
|
|
42
|
-
expect(result).toEqual({ short: 'Jul', full: 'July' });
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
it('should return August for 8', () => {
|
|
46
|
-
const result = getMonthName(8);
|
|
47
|
-
expect(result).toEqual({ short: 'Aug', full: 'August' });
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
it('should return September for 9', () => {
|
|
51
|
-
const result = getMonthName(9);
|
|
52
|
-
expect(result).toEqual({ short: 'Sep', full: 'September' });
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
it('should return October for 10', () => {
|
|
56
|
-
const result = getMonthName(10);
|
|
57
|
-
expect(result).toEqual({ short: 'Oct', full: 'October' });
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
it('should return November for 11', () => {
|
|
61
|
-
const result = getMonthName(11);
|
|
62
|
-
expect(result).toEqual({ short: 'Nov', full: 'November' });
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
it('should return December for 12', () => {
|
|
66
|
-
const result = getMonthName(12);
|
|
67
|
-
expect(result).toEqual({ short: 'Dec', full: 'December' });
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
it('should return January for 0', () => {
|
|
71
|
-
const result = getMonthName(0);
|
|
72
|
-
expect(result).toEqual({ short: 'Jan', full: 'January' });
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
it('should return January for 13', () => {
|
|
76
|
-
const result = getMonthName(13);
|
|
77
|
-
expect(result).toEqual({ short: 'Jan', full: 'January' });
|
|
78
|
-
});
|
|
79
|
-
});
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
const monthNames = [
|
|
2
|
-
{ short: 'Jan', full: 'January' },
|
|
3
|
-
{ short: 'Feb', full: 'February' },
|
|
4
|
-
{ short: 'Mar', full: 'March' },
|
|
5
|
-
{ short: 'Apr', full: 'April' },
|
|
6
|
-
{ short: 'May', full: 'May' },
|
|
7
|
-
{ short: 'Jun', full: 'June' },
|
|
8
|
-
{ short: 'Jul', full: 'July' },
|
|
9
|
-
{ short: 'Aug', full: 'August' },
|
|
10
|
-
{ short: 'Sep', full: 'September' },
|
|
11
|
-
{ short: 'Oct', full: 'October' },
|
|
12
|
-
{ short: 'Nov', full: 'November' },
|
|
13
|
-
{ short: 'Dec', full: 'December' },
|
|
14
|
-
];
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Get the name of a month given the month number (1 = January, etc.)
|
|
18
|
-
* If an invalid number is provided, we will treat it like January
|
|
19
|
-
* @author Gabe Abrams
|
|
20
|
-
* @param month the number of the month
|
|
21
|
-
* @returns object containing multiple month name formats:
|
|
22
|
-
* { short, full } where short will look like "Jan" and full will look like
|
|
23
|
-
* "January"
|
|
24
|
-
*/
|
|
25
|
-
const getMonthName = (month: number) => {
|
|
26
|
-
return (monthNames[month - 1] ?? monthNames[0]);
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
export default getMonthName;
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Test file for the getOrdinal helper
|
|
3
|
-
* @author Gabe Abrams
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
// Import main function
|
|
7
|
-
import getOrdinal from './getOrdinal';
|
|
8
|
-
|
|
9
|
-
describe('getOrdinal', () => {
|
|
10
|
-
it('should return "th" for 0', () => {
|
|
11
|
-
const result = getOrdinal(0);
|
|
12
|
-
expect(result).toEqual('th');
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
it('should return "st" for 1', () => {
|
|
16
|
-
const result = getOrdinal(1);
|
|
17
|
-
expect(result).toEqual('st');
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
it('should return "nd" for 2', () => {
|
|
21
|
-
const result = getOrdinal(2);
|
|
22
|
-
expect(result).toEqual('nd');
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
it('should return "rd" for 3', () => {
|
|
26
|
-
const result = getOrdinal(3);
|
|
27
|
-
expect(result).toEqual('rd');
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
it('should return "th" for 4', () => {
|
|
31
|
-
const result = getOrdinal(4);
|
|
32
|
-
expect(result).toEqual('th');
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
it('should return "th" for 11', () => {
|
|
36
|
-
const result = getOrdinal(11);
|
|
37
|
-
expect(result).toEqual('th');
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
it('should return "st" for 21', () => {
|
|
41
|
-
const result = getOrdinal(21);
|
|
42
|
-
expect(result).toEqual('st');
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
it('should return "nd" for 22', () => {
|
|
46
|
-
const result = getOrdinal(22);
|
|
47
|
-
expect(result).toEqual('nd');
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
it('should return "rd" for 23', () => {
|
|
51
|
-
const result = getOrdinal(23);
|
|
52
|
-
expect(result).toEqual('rd');
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
it('should return "th" for 24', () => {
|
|
56
|
-
const result = getOrdinal(24);
|
|
57
|
-
expect(result).toEqual('th');
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
it('should return "th" for 100', () => {
|
|
61
|
-
const result = getOrdinal(100);
|
|
62
|
-
expect(result).toEqual('th');
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
it('should return "st" for 101', () => {
|
|
66
|
-
const result = getOrdinal(101);
|
|
67
|
-
expect(result).toEqual('st');
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
it('should return "nd" for 102', () => {
|
|
71
|
-
const result = getOrdinal(102);
|
|
72
|
-
expect(result).toEqual('nd');
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
it('should return "rd" for 103', () => {
|
|
76
|
-
const result = getOrdinal(103);
|
|
77
|
-
expect(result).toEqual('rd');
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
it('should return "th" for 104', () => {
|
|
81
|
-
const result = getOrdinal(104);
|
|
82
|
-
expect(result).toEqual('th');
|
|
83
|
-
});
|
|
84
|
-
});
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
// Constants
|
|
2
|
-
const ORDINALS = ['th', 'st', 'nd', 'rd'];
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Get a number's ordinal
|
|
6
|
-
* @author Gabe Abrams
|
|
7
|
-
* @param num the number being analyzed
|
|
8
|
-
* @returns ordinal
|
|
9
|
-
*/
|
|
10
|
-
const getOrdinal = (num: number): string => {
|
|
11
|
-
return (ORDINALS[(num - 20) % 10] ?? ORDINALS[num] ?? ORDINALS[0]);
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export default getOrdinal;
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Test file for the getPartOfDay helper
|
|
3
|
-
* @author Gabe Abrams
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import getPartOfDay from './getPartOfDay';
|
|
7
|
-
|
|
8
|
-
describe('getPartOfDay', () => {
|
|
9
|
-
it('should return "morning" if the current hour is less than 12', () => {
|
|
10
|
-
// Mock the current hour to be 9am
|
|
11
|
-
jest.spyOn(Date.prototype, 'getHours').mockReturnValue(9);
|
|
12
|
-
|
|
13
|
-
const result = getPartOfDay();
|
|
14
|
-
expect(result).toEqual('morning');
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
it('should return "afternoon" if the current hour is between 12 and 16 (inclusive)', () => {
|
|
18
|
-
// Mock the current hour to be 2pm
|
|
19
|
-
jest.spyOn(Date.prototype, 'getHours').mockReturnValue(14);
|
|
20
|
-
|
|
21
|
-
const result = getPartOfDay();
|
|
22
|
-
expect(result).toEqual('afternoon');
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
it('should return "evening" if the current hour is between 17 and 24 (inclusive)', () => {
|
|
26
|
-
// Mock the current hour to be 8pm
|
|
27
|
-
jest.spyOn(Date.prototype, 'getHours').mockReturnValue(20);
|
|
28
|
-
|
|
29
|
-
const result = getPartOfDay();
|
|
30
|
-
expect(result).toEqual('evening');
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
it('should return "evening" if the current hour is 17', () => {
|
|
34
|
-
// Mock the current hour to be 5pm
|
|
35
|
-
jest.spyOn(Date.prototype, 'getHours').mockReturnValue(17);
|
|
36
|
-
|
|
37
|
-
const result = getPartOfDay();
|
|
38
|
-
expect(result).toEqual('evening');
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
it('should return "evening" if the current hour is 24', () => {
|
|
42
|
-
// Mock the current hour to be midnight
|
|
43
|
-
jest.spyOn(Date.prototype, 'getHours').mockReturnValue(24);
|
|
44
|
-
|
|
45
|
-
const result = getPartOfDay();
|
|
46
|
-
expect(result).toEqual('evening');
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
it('should return "morning" if the current hour is 0', () => {
|
|
50
|
-
// Mock the current hour to be midnight
|
|
51
|
-
jest.spyOn(Date.prototype, 'getHours').mockReturnValue(0);
|
|
52
|
-
|
|
53
|
-
const result = getPartOfDay();
|
|
54
|
-
expect(result).toEqual('morning');
|
|
55
|
-
});
|
|
56
|
-
});
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Get the current part of day (morning, evening, etc.)
|
|
3
|
-
* @author Gabe Abrams
|
|
4
|
-
* @returns the part of day (morning, evening, etc.)
|
|
5
|
-
*/
|
|
6
|
-
const getPartOfDay = () => {
|
|
7
|
-
// Setup the post-it time of day
|
|
8
|
-
let partOfDay = 'day';
|
|
9
|
-
const hours = new Date().getHours();
|
|
10
|
-
if (hours < 12) {
|
|
11
|
-
partOfDay = 'morning';
|
|
12
|
-
} else if (hours >= 12 && hours <= 16) {
|
|
13
|
-
partOfDay = 'afternoon';
|
|
14
|
-
} else if (hours > 16 && hours <= 24) {
|
|
15
|
-
partOfDay = 'evening';
|
|
16
|
-
}
|
|
17
|
-
return partOfDay;
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
export default getPartOfDay;
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Test file for the getTimeInfoInET helper
|
|
3
|
-
* @author Gabe Abrams
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
// Import main function
|
|
7
|
-
import getTimeInfoInET from './getTimeInfoInET';
|
|
8
|
-
|
|
9
|
-
describe('getTimeInfoInET', () => {
|
|
10
|
-
it('should return the current time info in ET if no argument is passed', () => {
|
|
11
|
-
const result = getTimeInfoInET();
|
|
12
|
-
const now = new Date();
|
|
13
|
-
const expectedTimestamp = now.getTime();
|
|
14
|
-
const expectedYear = now.getFullYear();
|
|
15
|
-
const expectedMonth = now.getMonth() + 1;
|
|
16
|
-
const expectedDay = now.getDate();
|
|
17
|
-
const expectedHour = now.getHours();
|
|
18
|
-
const expectedHour12 = expectedHour % 12 || 12;
|
|
19
|
-
const expectedMinute = now.getMinutes();
|
|
20
|
-
const expectedIsPM = expectedHour >= 12;
|
|
21
|
-
expect(result.timestamp).toBeCloseTo(expectedTimestamp, -2);
|
|
22
|
-
expect(result.year).toEqual(expectedYear);
|
|
23
|
-
expect(result.month).toEqual(expectedMonth);
|
|
24
|
-
expect(result.day).toEqual(expectedDay);
|
|
25
|
-
expect(result.hour).toEqual(expectedHour);
|
|
26
|
-
expect(result.hour12).toEqual(expectedHour12);
|
|
27
|
-
expect(result.minute).toEqual(expectedMinute);
|
|
28
|
-
expect(result.isPM).toEqual(expectedIsPM);
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
it('should return the time info in ET for a specified date', () => {
|
|
32
|
-
const date = new Date('2022-01-01T00:00:00Z');
|
|
33
|
-
const result = getTimeInfoInET(date);
|
|
34
|
-
const expectedTimestamp = date.getTime();
|
|
35
|
-
const expectedYear = 2021;
|
|
36
|
-
const expectedMonth = 12;
|
|
37
|
-
const expectedDay = 31;
|
|
38
|
-
const expectedHour = 19;
|
|
39
|
-
const expectedHour12 = 7;
|
|
40
|
-
const expectedMinute = 0;
|
|
41
|
-
const expectedIsPM = true;
|
|
42
|
-
expect(result.timestamp).toEqual(expectedTimestamp);
|
|
43
|
-
expect(result.year).toEqual(expectedYear);
|
|
44
|
-
expect(result.month).toEqual(expectedMonth);
|
|
45
|
-
expect(result.day).toEqual(expectedDay);
|
|
46
|
-
expect(result.hour).toEqual(expectedHour);
|
|
47
|
-
expect(result.hour12).toEqual(expectedHour12);
|
|
48
|
-
expect(result.minute).toEqual(expectedMinute);
|
|
49
|
-
expect(result.isPM).toEqual(expectedIsPM);
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
it('should return the time info in ET for a specified timestamp', () => {
|
|
53
|
-
const timestamp = 1640995200000; // 2022-01-01T00:00:00Z
|
|
54
|
-
const result = getTimeInfoInET(timestamp);
|
|
55
|
-
const expectedTimestamp = timestamp;
|
|
56
|
-
const expectedYear = 2021;
|
|
57
|
-
const expectedMonth = 12;
|
|
58
|
-
const expectedDay = 31;
|
|
59
|
-
const expectedHour = 19;
|
|
60
|
-
const expectedHour12 = 7;
|
|
61
|
-
const expectedMinute = 0;
|
|
62
|
-
const expectedIsPM = true;
|
|
63
|
-
expect(result.timestamp).toEqual(expectedTimestamp);
|
|
64
|
-
expect(result.year).toEqual(expectedYear);
|
|
65
|
-
expect(result.month).toEqual(expectedMonth);
|
|
66
|
-
expect(result.day).toEqual(expectedDay);
|
|
67
|
-
expect(result.hour).toEqual(expectedHour);
|
|
68
|
-
expect(result.hour12).toEqual(expectedHour12);
|
|
69
|
-
expect(result.minute).toEqual(expectedMinute);
|
|
70
|
-
expect(result.isPM).toEqual(expectedIsPM);
|
|
71
|
-
});
|
|
72
|
-
});
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Get current time info in US Boston Eastern Time, independent of machine
|
|
3
|
-
* timezone
|
|
4
|
-
* @author Gabe Abrams
|
|
5
|
-
* @param [dateOrTimestamp=now] the date to get info on or a ms since epoch timestamp
|
|
6
|
-
* @returns object with timestamp (ms since epoch) and numbers
|
|
7
|
-
* corresponding to ET time values for year, month, day, hour, hour12, minute, second, isPM
|
|
8
|
-
* where hour is in 24hr time and hour12 is in 12hr time.
|
|
9
|
-
*/
|
|
10
|
-
const getTimeInfoInET = (dateOrTimestamp?: Date | number): {
|
|
11
|
-
timestamp: number,
|
|
12
|
-
year: number,
|
|
13
|
-
month: number,
|
|
14
|
-
day: number,
|
|
15
|
-
hour: number,
|
|
16
|
-
hour12: number,
|
|
17
|
-
minute: number,
|
|
18
|
-
second: number,
|
|
19
|
-
isPM: boolean,
|
|
20
|
-
} => {
|
|
21
|
-
// Create a time string
|
|
22
|
-
let d: Date;
|
|
23
|
-
if (!dateOrTimestamp) {
|
|
24
|
-
// Use now
|
|
25
|
-
d = new Date();
|
|
26
|
-
} else if (typeof dateOrTimestamp === 'number') {
|
|
27
|
-
// Convert to date
|
|
28
|
-
d = new Date(dateOrTimestamp);
|
|
29
|
-
} else {
|
|
30
|
-
// Already a date
|
|
31
|
-
d = dateOrTimestamp;
|
|
32
|
-
}
|
|
33
|
-
const str = d.toLocaleString(
|
|
34
|
-
'en-US', // Using US encoding (it's the only one installed on containers)
|
|
35
|
-
{ timeZone: 'America/New_York' }, // Force EST timezone
|
|
36
|
-
);
|
|
37
|
-
|
|
38
|
-
// Parse the string for the date/time info
|
|
39
|
-
const [dateStr, timeStr] = str.split(', '); // Format: MM/DD/YYYY, HH:MM:SS AM
|
|
40
|
-
const [monthStr, dayStr, yearStr] = dateStr.split('/'); // Format: MM/DD/YYYY
|
|
41
|
-
const [hourStr, minStr, ending] = timeStr.split(':'); // Format: HH:MM:SS AM
|
|
42
|
-
|
|
43
|
-
// Create all time numbers
|
|
44
|
-
const timestamp = d.getTime();
|
|
45
|
-
const year = Number.parseInt(yearStr, 10);
|
|
46
|
-
const month = Number.parseInt(monthStr, 10);
|
|
47
|
-
const day = Number.parseInt(dayStr, 10);
|
|
48
|
-
const minute = Number.parseInt(minStr, 10);
|
|
49
|
-
const second = (
|
|
50
|
-
ending.split(' ')[0]
|
|
51
|
-
? Number.parseInt(ending.split(' ')[0], 10)
|
|
52
|
-
: 0
|
|
53
|
-
);
|
|
54
|
-
const hour12 = Number.parseInt(hourStr, 10);
|
|
55
|
-
// Convert from am/pm to 24hr
|
|
56
|
-
const isAM = ending.toLowerCase().includes('am');
|
|
57
|
-
const isPM = !isAM;
|
|
58
|
-
let hour = hour12;
|
|
59
|
-
if (isPM && hour12 !== 12) {
|
|
60
|
-
hour += 12;
|
|
61
|
-
} else if (isAM && hour12 === 12) {
|
|
62
|
-
hour = 0;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
// Return
|
|
66
|
-
return {
|
|
67
|
-
timestamp,
|
|
68
|
-
year,
|
|
69
|
-
month,
|
|
70
|
-
day,
|
|
71
|
-
hour,
|
|
72
|
-
hour12,
|
|
73
|
-
isPM,
|
|
74
|
-
minute,
|
|
75
|
-
second,
|
|
76
|
-
};
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
export default getTimeInfoInET;
|