tiny-essentials 1.28.11 โ 1.28.12
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/changelog/1/28/12.md +7 -0
- package/dist/v1/TinyBasicsEs.min.js +1 -1
- package/dist/v1/TinyEssentials.min.js +1 -1
- package/dist/v1/basics/clock.cjs +16 -1
- package/dist/v1/basics/clock.d.mts +11 -2
- package/dist/v1/basics/clock.mjs +14 -1
- package/dist/v1/basics/index.cjs +1 -0
- package/dist/v1/basics/index.d.mts +2 -2
- package/dist/v1/basics/index.mjs +2 -2
- package/dist/v1/index.cjs +1 -0
- package/dist/v1/index.d.mts +2 -2
- package/dist/v1/index.mjs +2 -2
- package/docs/v1/basics/clock.md +17 -1
- package/package.json +1 -1
package/dist/v1/basics/clock.cjs
CHANGED
|
@@ -1,12 +1,26 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Determines the user's preferred time format (12-hour or 24-hour)
|
|
5
|
+
* based on the system's locale settings.
|
|
6
|
+
*
|
|
7
|
+
* Credits: https://www.reddit.com/r/webdev/comments/1azu87y/comment/ks3mtci/?utm_source=share&utm_medium=web3x&utm_name=web3xcss&utm_term=1&utm_content=share_button
|
|
8
|
+
*
|
|
9
|
+
* @returns {12|24} Returns 12 if the user's locale uses a 12-hour cycle, otherwise returns 24.
|
|
10
|
+
*/
|
|
11
|
+
function getUserTimeFormat() {
|
|
12
|
+
const format = new Intl.DateTimeFormat(undefined, { hour: 'numeric' }).resolvedOptions()
|
|
13
|
+
.hourCycle;
|
|
14
|
+
return format?.startsWith('h12') ? 12 : 24;
|
|
15
|
+
}
|
|
16
|
+
|
|
3
17
|
/**
|
|
4
18
|
* Calculates the time duration between the current time and a given time offset.
|
|
5
19
|
*
|
|
6
20
|
* @param {Date} timeData - The target time as a Date object.
|
|
7
21
|
* @param {'asMilliseconds'|'asSeconds'|'asMinutes'|'asHours'|'asDays'} [durationType='asSeconds'] - The type of duration to return.
|
|
8
22
|
* @param {Date|null} [now=null] - The current time as a Date object. Defaults to the current date and time if not provided.
|
|
9
|
-
* @returns {number
|
|
23
|
+
* @returns {number} The calculated duration in the specified unit, or `null` if `timeData` is not provided.
|
|
10
24
|
*/
|
|
11
25
|
function getTimeDuration(timeData = new Date(), durationType = 'asSeconds', now = null) {
|
|
12
26
|
if (!(timeData instanceof Date)) {
|
|
@@ -383,3 +397,4 @@ exports.formatCustomTimer = formatCustomTimer;
|
|
|
383
397
|
exports.formatDayTimer = formatDayTimer;
|
|
384
398
|
exports.formatTimer = formatTimer;
|
|
385
399
|
exports.getTimeDuration = getTimeDuration;
|
|
400
|
+
exports.getUserTimeFormat = getUserTimeFormat;
|
|
@@ -1,12 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Determines the user's preferred time format (12-hour or 24-hour)
|
|
3
|
+
* based on the system's locale settings.
|
|
4
|
+
*
|
|
5
|
+
* Credits: https://www.reddit.com/r/webdev/comments/1azu87y/comment/ks3mtci/?utm_source=share&utm_medium=web3x&utm_name=web3xcss&utm_term=1&utm_content=share_button
|
|
6
|
+
*
|
|
7
|
+
* @returns {12|24} Returns 12 if the user's locale uses a 12-hour cycle, otherwise returns 24.
|
|
8
|
+
*/
|
|
9
|
+
export declare function getUserTimeFormat(): 12 | 24;
|
|
1
10
|
/**
|
|
2
11
|
* Calculates the time duration between the current time and a given time offset.
|
|
3
12
|
*
|
|
4
13
|
* @param {Date} timeData - The target time as a Date object.
|
|
5
14
|
* @param {'asMilliseconds'|'asSeconds'|'asMinutes'|'asHours'|'asDays'} [durationType='asSeconds'] - The type of duration to return.
|
|
6
15
|
* @param {Date|null} [now=null] - The current time as a Date object. Defaults to the current date and time if not provided.
|
|
7
|
-
* @returns {number
|
|
16
|
+
* @returns {number} The calculated duration in the specified unit, or `null` if `timeData` is not provided.
|
|
8
17
|
*/
|
|
9
|
-
export declare function getTimeDuration(timeData?: Date, durationType?: 'asMilliseconds' | 'asSeconds' | 'asMinutes' | 'asHours' | 'asDays', now?: Date | null): number
|
|
18
|
+
export declare function getTimeDuration(timeData?: Date, durationType?: 'asMilliseconds' | 'asSeconds' | 'asMinutes' | 'asHours' | 'asDays', now?: Date | null): number;
|
|
10
19
|
/**
|
|
11
20
|
* Formats a custom timer string based on total seconds and a detail level.
|
|
12
21
|
* Includes proper reallocation of lower units into higher ones, ensuring consistent hierarchy.
|
package/dist/v1/basics/clock.mjs
CHANGED
|
@@ -1,10 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Determines the user's preferred time format (12-hour or 24-hour)
|
|
3
|
+
* based on the system's locale settings.
|
|
4
|
+
*
|
|
5
|
+
* Credits: https://www.reddit.com/r/webdev/comments/1azu87y/comment/ks3mtci/?utm_source=share&utm_medium=web3x&utm_name=web3xcss&utm_term=1&utm_content=share_button
|
|
6
|
+
*
|
|
7
|
+
* @returns {12|24} Returns 12 if the user's locale uses a 12-hour cycle, otherwise returns 24.
|
|
8
|
+
*/
|
|
9
|
+
export function getUserTimeFormat() {
|
|
10
|
+
const format = new Intl.DateTimeFormat(undefined, { hour: 'numeric' }).resolvedOptions()
|
|
11
|
+
.hourCycle;
|
|
12
|
+
return format?.startsWith('h12') ? 12 : 24;
|
|
13
|
+
}
|
|
1
14
|
/**
|
|
2
15
|
* Calculates the time duration between the current time and a given time offset.
|
|
3
16
|
*
|
|
4
17
|
* @param {Date} timeData - The target time as a Date object.
|
|
5
18
|
* @param {'asMilliseconds'|'asSeconds'|'asMinutes'|'asHours'|'asDays'} [durationType='asSeconds'] - The type of duration to return.
|
|
6
19
|
* @param {Date|null} [now=null] - The current time as a Date object. Defaults to the current date and time if not provided.
|
|
7
|
-
* @returns {number
|
|
20
|
+
* @returns {number} The calculated duration in the specified unit, or `null` if `timeData` is not provided.
|
|
8
21
|
*/
|
|
9
22
|
export function getTimeDuration(timeData = new Date(), durationType = 'asSeconds', now = null) {
|
|
10
23
|
if (!(timeData instanceof Date)) {
|
package/dist/v1/basics/index.cjs
CHANGED
|
@@ -24,6 +24,7 @@ exports.formatCustomTimer = clock.formatCustomTimer;
|
|
|
24
24
|
exports.formatDayTimer = clock.formatDayTimer;
|
|
25
25
|
exports.formatTimer = clock.formatTimer;
|
|
26
26
|
exports.getTimeDuration = clock.getTimeDuration;
|
|
27
|
+
exports.getUserTimeFormat = clock.getUserTimeFormat;
|
|
27
28
|
exports.fetchJson = html.fetchJson;
|
|
28
29
|
exports.fetchText = html.fetchText;
|
|
29
30
|
exports.installWindowHiddenScript = html.installWindowHiddenScript;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { diffArrayList, shuffleArray, arraySortPositions, multiplyArrayBlocks } from './array.mjs';
|
|
2
|
-
import { breakdownDuration, formatCustomTimer, formatDayTimer, formatTimer, getTimeDuration } from './clock.mjs';
|
|
2
|
+
import { breakdownDuration, formatCustomTimer, formatDayTimer, formatTimer, getTimeDuration, getUserTimeFormat } from './clock.mjs';
|
|
3
3
|
import { readJsonBlob, saveJsonFile, fetchJson, installWindowHiddenScript, readFileBlob, readBase64Blob, fetchText } from './html.mjs';
|
|
4
4
|
import { extendObjType, reorderObjTypeOrder, cloneObjTypeOrder, objType, isObjType, objTypeName } from './objFilter.mjs';
|
|
5
5
|
import { countObj, isJsonObject, isValidObj } from './objChecker.mjs';
|
|
@@ -10,5 +10,5 @@ import { areElsCollTop, areElsCollBottom, areElsCollLeft, areElsCollRight, areEl
|
|
|
10
10
|
import { extractMediaId3Tags, parseMediaMetadata, valMediaContentMetadata, valMediaContentMetadataPartial } from './mediaContent.mjs';
|
|
11
11
|
import { createSingletonTask, waitForTrue } from './promiseUtils.mjs';
|
|
12
12
|
import { browserIs, getBrowserCssPrefix, getBrowserPings, getDuckTyping, isBrowserAgent } from './browserDetector.mjs';
|
|
13
|
-
export { getBrowserPings, isBrowserAgent, getBrowserCssPrefix, getDuckTyping, browserIs, isValidObj, createSingletonTask, waitForTrue, multiplyArrayBlocks, valMediaContentMetadata, valMediaContentMetadataPartial, parseMediaMetadata, extractMediaId3Tags, diffStrings, diffObjList, diffArrayList, breakdownDuration, calculateMarketcap, compareMarketcap, getPercentage, areElsCollTop, areElsCollBottom, areElsCollLeft, areElsCollRight, areElsCollPerfTop, areElsCollPerfBottom, areElsCollPerfLeft, areElsCollPerfRight, areElsColliding, areElsPerfColliding, getElsColliding, getElsPerfColliding, getElsCollOverlap, getElsCollOverlapPos, getRectCenter, getElsRelativeCenterOffset, getElsCollDirDepth, getElsCollDetails, safeTextTrim, installWindowHiddenScript, genFibonacciSeq, fetchJson, fetchText, readJsonBlob, readFileBlob, readBase64Blob, saveJsonFile, documentIsFullScreen, isScreenFilled, requestFullScreen, exitFullScreen, isFullScreenMode, onFullScreenChange, offFullScreenChange, isJsonObject, arraySortPositions, formatBytes, addAiMarkerShortcut, extendObjType, reorderObjTypeOrder, cloneObjTypeOrder, countObj, isObjType, objTypeName, objType, ruleOfThree, getSimplePerc, asyncReplace, getAge, formatCustomTimer, formatDayTimer, formatTimer, getTimeDuration, shuffleArray, toTitleCase, toTitleCaseLowerFirst, };
|
|
13
|
+
export { getUserTimeFormat, getBrowserPings, isBrowserAgent, getBrowserCssPrefix, getDuckTyping, browserIs, isValidObj, createSingletonTask, waitForTrue, multiplyArrayBlocks, valMediaContentMetadata, valMediaContentMetadataPartial, parseMediaMetadata, extractMediaId3Tags, diffStrings, diffObjList, diffArrayList, breakdownDuration, calculateMarketcap, compareMarketcap, getPercentage, areElsCollTop, areElsCollBottom, areElsCollLeft, areElsCollRight, areElsCollPerfTop, areElsCollPerfBottom, areElsCollPerfLeft, areElsCollPerfRight, areElsColliding, areElsPerfColliding, getElsColliding, getElsPerfColliding, getElsCollOverlap, getElsCollOverlapPos, getRectCenter, getElsRelativeCenterOffset, getElsCollDirDepth, getElsCollDetails, safeTextTrim, installWindowHiddenScript, genFibonacciSeq, fetchJson, fetchText, readJsonBlob, readFileBlob, readBase64Blob, saveJsonFile, documentIsFullScreen, isScreenFilled, requestFullScreen, exitFullScreen, isFullScreenMode, onFullScreenChange, offFullScreenChange, isJsonObject, arraySortPositions, formatBytes, addAiMarkerShortcut, extendObjType, reorderObjTypeOrder, cloneObjTypeOrder, countObj, isObjType, objTypeName, objType, ruleOfThree, getSimplePerc, asyncReplace, getAge, formatCustomTimer, formatDayTimer, formatTimer, getTimeDuration, shuffleArray, toTitleCase, toTitleCaseLowerFirst, };
|
|
14
14
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/v1/basics/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { diffArrayList, shuffleArray, arraySortPositions, multiplyArrayBlocks } from './array.mjs';
|
|
2
|
-
import { breakdownDuration, formatCustomTimer, formatDayTimer, formatTimer, getTimeDuration, } from './clock.mjs';
|
|
2
|
+
import { breakdownDuration, formatCustomTimer, formatDayTimer, formatTimer, getTimeDuration, getUserTimeFormat, } from './clock.mjs';
|
|
3
3
|
import { readJsonBlob, saveJsonFile, fetchJson, installWindowHiddenScript, readFileBlob, readBase64Blob, fetchText, } from './html.mjs';
|
|
4
4
|
import { extendObjType, reorderObjTypeOrder, cloneObjTypeOrder, objType, isObjType, objTypeName, } from './objFilter.mjs';
|
|
5
5
|
import { countObj, isJsonObject, isValidObj } from './objChecker.mjs';
|
|
@@ -10,4 +10,4 @@ import { areElsCollTop, areElsCollBottom, areElsCollLeft, areElsCollRight, areEl
|
|
|
10
10
|
import { extractMediaId3Tags, parseMediaMetadata, valMediaContentMetadata, valMediaContentMetadataPartial, } from './mediaContent.mjs';
|
|
11
11
|
import { createSingletonTask, waitForTrue } from './promiseUtils.mjs';
|
|
12
12
|
import { browserIs, getBrowserCssPrefix, getBrowserPings, getDuckTyping, isBrowserAgent, } from './browserDetector.mjs';
|
|
13
|
-
export { getBrowserPings, isBrowserAgent, getBrowserCssPrefix, getDuckTyping, browserIs, isValidObj, createSingletonTask, waitForTrue, multiplyArrayBlocks, valMediaContentMetadata, valMediaContentMetadataPartial, parseMediaMetadata, extractMediaId3Tags, diffStrings, diffObjList, diffArrayList, breakdownDuration, calculateMarketcap, compareMarketcap, getPercentage, areElsCollTop, areElsCollBottom, areElsCollLeft, areElsCollRight, areElsCollPerfTop, areElsCollPerfBottom, areElsCollPerfLeft, areElsCollPerfRight, areElsColliding, areElsPerfColliding, getElsColliding, getElsPerfColliding, getElsCollOverlap, getElsCollOverlapPos, getRectCenter, getElsRelativeCenterOffset, getElsCollDirDepth, getElsCollDetails, safeTextTrim, installWindowHiddenScript, genFibonacciSeq, fetchJson, fetchText, readJsonBlob, readFileBlob, readBase64Blob, saveJsonFile, documentIsFullScreen, isScreenFilled, requestFullScreen, exitFullScreen, isFullScreenMode, onFullScreenChange, offFullScreenChange, isJsonObject, arraySortPositions, formatBytes, addAiMarkerShortcut, extendObjType, reorderObjTypeOrder, cloneObjTypeOrder, countObj, isObjType, objTypeName, objType, ruleOfThree, getSimplePerc, asyncReplace, getAge, formatCustomTimer, formatDayTimer, formatTimer, getTimeDuration, shuffleArray, toTitleCase, toTitleCaseLowerFirst, };
|
|
13
|
+
export { getUserTimeFormat, getBrowserPings, isBrowserAgent, getBrowserCssPrefix, getDuckTyping, browserIs, isValidObj, createSingletonTask, waitForTrue, multiplyArrayBlocks, valMediaContentMetadata, valMediaContentMetadataPartial, parseMediaMetadata, extractMediaId3Tags, diffStrings, diffObjList, diffArrayList, breakdownDuration, calculateMarketcap, compareMarketcap, getPercentage, areElsCollTop, areElsCollBottom, areElsCollLeft, areElsCollRight, areElsCollPerfTop, areElsCollPerfBottom, areElsCollPerfLeft, areElsCollPerfRight, areElsColliding, areElsPerfColliding, getElsColliding, getElsPerfColliding, getElsCollOverlap, getElsCollOverlapPos, getRectCenter, getElsRelativeCenterOffset, getElsCollDirDepth, getElsCollDetails, safeTextTrim, installWindowHiddenScript, genFibonacciSeq, fetchJson, fetchText, readJsonBlob, readFileBlob, readBase64Blob, saveJsonFile, documentIsFullScreen, isScreenFilled, requestFullScreen, exitFullScreen, isFullScreenMode, onFullScreenChange, offFullScreenChange, isJsonObject, arraySortPositions, formatBytes, addAiMarkerShortcut, extendObjType, reorderObjTypeOrder, cloneObjTypeOrder, countObj, isObjType, objTypeName, objType, ruleOfThree, getSimplePerc, asyncReplace, getAge, formatCustomTimer, formatDayTimer, formatTimer, getTimeDuration, shuffleArray, toTitleCase, toTitleCaseLowerFirst, };
|
package/dist/v1/index.cjs
CHANGED
|
@@ -71,6 +71,7 @@ exports.formatCustomTimer = clock.formatCustomTimer;
|
|
|
71
71
|
exports.formatDayTimer = clock.formatDayTimer;
|
|
72
72
|
exports.formatTimer = clock.formatTimer;
|
|
73
73
|
exports.getTimeDuration = clock.getTimeDuration;
|
|
74
|
+
exports.getUserTimeFormat = clock.getUserTimeFormat;
|
|
74
75
|
exports.checkObj = objFilter.checkObj;
|
|
75
76
|
exports.cloneObjTypeOrder = objFilter.cloneObjTypeOrder;
|
|
76
77
|
exports.extendObjType = objFilter.extendObjType;
|
package/dist/v1/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import TinyLevelUp from './libs/TinyLevelUp.mjs';
|
|
2
2
|
import { diffArrayList, shuffleArray, arraySortPositions, multiplyArrayBlocks } from './basics/array.mjs';
|
|
3
|
-
import { breakdownDuration, formatCustomTimer, formatDayTimer, formatTimer, getTimeDuration } from './basics/clock.mjs';
|
|
3
|
+
import { breakdownDuration, formatCustomTimer, formatDayTimer, formatTimer, getTimeDuration, getUserTimeFormat } from './basics/clock.mjs';
|
|
4
4
|
import { extendObjType, reorderObjTypeOrder, cloneObjTypeOrder, objType, checkObj, objTypeName, isObjType } from './basics/objFilter.mjs';
|
|
5
5
|
import { countObj, isJsonObject, isValidObj } from './basics/objChecker.mjs';
|
|
6
6
|
import { documentIsFullScreen, isScreenFilled, requestFullScreen, exitFullScreen, isFullScreenMode, onFullScreenChange, offFullScreenChange } from './basics/fullScreen.mjs';
|
|
@@ -56,5 +56,5 @@ import { createCheckDestroyed } from './libs/utils.mjs';
|
|
|
56
56
|
import { createSingletonTask, waitForTrue } from './basics/promiseUtils.mjs';
|
|
57
57
|
import TinyDebugger from './libs/TinyDebugger.mjs';
|
|
58
58
|
import { browserIs, getBrowserCssPrefix, getBrowserPings, getDuckTyping, isBrowserAgent } from './basics/browserDetector.mjs';
|
|
59
|
-
export { TinyDebugger, TinyMediaPlayer, TinyRadioFm, TinyClassManager, FuzzySet, MamdaniInferenceSystem, TinyArrayComparator, TinyTextDiffer, TinyAnalogClock, TinyColorValidator, TinyLoadingScreen, TinyElementObserver, TinySimpleDice, TinyNeedBar, TinyI18, TinyCookieConsent, TinyInventory, TinyInventoryTrader, TinyArrayPaginator, TinyAdvancedRaffle, TinyDayNightCycle, TinyGamepad, TinyTextarea, TinyNewWinEvents, TinyIframeEvents, TinyLocalStorage, TinyTimeout, TinyColorConverter, TinyClipboard, TinyTextRangeEditor, TinySmartScroller, UltraRandomMsgGen, TinyAfterScrollWatcher, TinyHtml, TinyNotifications, TinyDomReadyManager, TinyDragger, TinyDragDropDetector, TinyToastNotify, TinyNotifyCenter, TinyRateLimiter, ColorSafeStringify, TinyPromiseQueue, TinyLevelUp, getBrowserPings, isBrowserAgent, getBrowserCssPrefix, getDuckTyping, browserIs, isValidObj, createSingletonTask, waitForTrue, multiplyArrayBlocks, createCheckDestroyed, valMediaContentMetadata, valMediaContentMetadataPartial, parseMediaMetadata, extractMediaId3Tags, defuzzifyCentroid, trapezoid, diffArrayList, diffStrings, diffObjList, breakdownDuration, calculateMarketcap, compareMarketcap, getPercentage, areElsCollTop, areElsCollBottom, areElsCollLeft, areElsCollRight, areElsCollPerfTop, areElsCollPerfBottom, areElsCollPerfLeft, areElsCollPerfRight, areElsColliding, areElsPerfColliding, getElsColliding, getElsPerfColliding, getElsCollOverlap, getElsCollOverlapPos, getRectCenter, getElsRelativeCenterOffset, getElsCollDirDepth, getElsCollDetails, safeTextTrim, installWindowHiddenScript, genFibonacciSeq, isDirEmptyAsync, fileSizeAsync, dirSizeAsync, listFilesAsync, listDirsAsync, getLatestBackupPath, fetchJson, fetchText, readJsonBlob, readFileBlob, readBase64Blob, saveJsonFile, readJsonFile, writeJsonFile, ensureDirectory, clearDirectoryAsync, clearDirectory, fileExists, dirExists, isDirEmpty, ensureCopyFile, tryDeleteFile, writeTextFile, listFiles, listDirs, fileSize, dirSize, backupFile, restoreLatestBackup, renameFileBatch, renameFileRegex, renameFileAddPrefixSuffix, renameFileNormalizeCase, renameFilePadNumbers, documentIsFullScreen, isScreenFilled, requestFullScreen, exitFullScreen, isFullScreenMode, onFullScreenChange, offFullScreenChange, isJsonObject, arraySortPositions, formatBytes, addAiMarkerShortcut, extendObjType, reorderObjTypeOrder, cloneObjTypeOrder, countObj, checkObj, objTypeName, isObjType, objType, ruleOfThree, getSimplePerc, asyncReplace, getAge, formatCustomTimer, formatDayTimer, formatTimer, getTimeDuration, shuffleArray, toTitleCase, toTitleCaseLowerFirst, };
|
|
59
|
+
export { TinyDebugger, TinyMediaPlayer, TinyRadioFm, TinyClassManager, FuzzySet, MamdaniInferenceSystem, TinyArrayComparator, TinyTextDiffer, TinyAnalogClock, TinyColorValidator, TinyLoadingScreen, TinyElementObserver, TinySimpleDice, TinyNeedBar, TinyI18, TinyCookieConsent, TinyInventory, TinyInventoryTrader, TinyArrayPaginator, TinyAdvancedRaffle, TinyDayNightCycle, TinyGamepad, TinyTextarea, TinyNewWinEvents, TinyIframeEvents, TinyLocalStorage, TinyTimeout, TinyColorConverter, TinyClipboard, TinyTextRangeEditor, TinySmartScroller, UltraRandomMsgGen, TinyAfterScrollWatcher, TinyHtml, TinyNotifications, TinyDomReadyManager, TinyDragger, TinyDragDropDetector, TinyToastNotify, TinyNotifyCenter, TinyRateLimiter, ColorSafeStringify, TinyPromiseQueue, TinyLevelUp, getUserTimeFormat, getBrowserPings, isBrowserAgent, getBrowserCssPrefix, getDuckTyping, browserIs, isValidObj, createSingletonTask, waitForTrue, multiplyArrayBlocks, createCheckDestroyed, valMediaContentMetadata, valMediaContentMetadataPartial, parseMediaMetadata, extractMediaId3Tags, defuzzifyCentroid, trapezoid, diffArrayList, diffStrings, diffObjList, breakdownDuration, calculateMarketcap, compareMarketcap, getPercentage, areElsCollTop, areElsCollBottom, areElsCollLeft, areElsCollRight, areElsCollPerfTop, areElsCollPerfBottom, areElsCollPerfLeft, areElsCollPerfRight, areElsColliding, areElsPerfColliding, getElsColliding, getElsPerfColliding, getElsCollOverlap, getElsCollOverlapPos, getRectCenter, getElsRelativeCenterOffset, getElsCollDirDepth, getElsCollDetails, safeTextTrim, installWindowHiddenScript, genFibonacciSeq, isDirEmptyAsync, fileSizeAsync, dirSizeAsync, listFilesAsync, listDirsAsync, getLatestBackupPath, fetchJson, fetchText, readJsonBlob, readFileBlob, readBase64Blob, saveJsonFile, readJsonFile, writeJsonFile, ensureDirectory, clearDirectoryAsync, clearDirectory, fileExists, dirExists, isDirEmpty, ensureCopyFile, tryDeleteFile, writeTextFile, listFiles, listDirs, fileSize, dirSize, backupFile, restoreLatestBackup, renameFileBatch, renameFileRegex, renameFileAddPrefixSuffix, renameFileNormalizeCase, renameFilePadNumbers, documentIsFullScreen, isScreenFilled, requestFullScreen, exitFullScreen, isFullScreenMode, onFullScreenChange, offFullScreenChange, isJsonObject, arraySortPositions, formatBytes, addAiMarkerShortcut, extendObjType, reorderObjTypeOrder, cloneObjTypeOrder, countObj, checkObj, objTypeName, isObjType, objType, ruleOfThree, getSimplePerc, asyncReplace, getAge, formatCustomTimer, formatDayTimer, formatTimer, getTimeDuration, shuffleArray, toTitleCase, toTitleCaseLowerFirst, };
|
|
60
60
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/v1/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import TinyLevelUp from './libs/TinyLevelUp.mjs';
|
|
2
2
|
import { diffArrayList, shuffleArray, arraySortPositions, multiplyArrayBlocks, } from './basics/array.mjs';
|
|
3
|
-
import { breakdownDuration, formatCustomTimer, formatDayTimer, formatTimer, getTimeDuration, } from './basics/clock.mjs';
|
|
3
|
+
import { breakdownDuration, formatCustomTimer, formatDayTimer, formatTimer, getTimeDuration, getUserTimeFormat, } from './basics/clock.mjs';
|
|
4
4
|
import { extendObjType, reorderObjTypeOrder, cloneObjTypeOrder, objType, checkObj, objTypeName, isObjType, } from './basics/objFilter.mjs';
|
|
5
5
|
import { countObj, isJsonObject, isValidObj } from './basics/objChecker.mjs';
|
|
6
6
|
import { documentIsFullScreen, isScreenFilled, requestFullScreen, exitFullScreen, isFullScreenMode, onFullScreenChange, offFullScreenChange, } from './basics/fullScreen.mjs';
|
|
@@ -59,4 +59,4 @@ import { browserIs, getBrowserCssPrefix, getBrowserPings, getDuckTyping, isBrows
|
|
|
59
59
|
// import TinyHtmlElems from './libs/TinyHtml/index.mjs';
|
|
60
60
|
export { TinyDebugger, TinyMediaPlayer, TinyRadioFm, TinyClassManager, FuzzySet, MamdaniInferenceSystem, TinyArrayComparator, TinyTextDiffer, TinyAnalogClock,
|
|
61
61
|
// TinyHtmlElems,
|
|
62
|
-
TinyColorValidator, TinyLoadingScreen, TinyElementObserver, TinySimpleDice, TinyNeedBar, TinyI18, TinyCookieConsent, TinyInventory, TinyInventoryTrader, TinyArrayPaginator, TinyAdvancedRaffle, TinyDayNightCycle, TinyGamepad, TinyTextarea, TinyNewWinEvents, TinyIframeEvents, TinyLocalStorage, TinyTimeout, TinyColorConverter, TinyClipboard, TinyTextRangeEditor, TinySmartScroller, UltraRandomMsgGen, TinyAfterScrollWatcher, TinyHtml, TinyNotifications, TinyDomReadyManager, TinyDragger, TinyDragDropDetector, TinyToastNotify, TinyNotifyCenter, TinyRateLimiter, ColorSafeStringify, TinyPromiseQueue, TinyLevelUp, getBrowserPings, isBrowserAgent, getBrowserCssPrefix, getDuckTyping, browserIs, isValidObj, createSingletonTask, waitForTrue, multiplyArrayBlocks, createCheckDestroyed, valMediaContentMetadata, valMediaContentMetadataPartial, parseMediaMetadata, extractMediaId3Tags, defuzzifyCentroid, trapezoid, diffArrayList, diffStrings, diffObjList, breakdownDuration, calculateMarketcap, compareMarketcap, getPercentage, areElsCollTop, areElsCollBottom, areElsCollLeft, areElsCollRight, areElsCollPerfTop, areElsCollPerfBottom, areElsCollPerfLeft, areElsCollPerfRight, areElsColliding, areElsPerfColliding, getElsColliding, getElsPerfColliding, getElsCollOverlap, getElsCollOverlapPos, getRectCenter, getElsRelativeCenterOffset, getElsCollDirDepth, getElsCollDetails, safeTextTrim, installWindowHiddenScript, genFibonacciSeq, isDirEmptyAsync, fileSizeAsync, dirSizeAsync, listFilesAsync, listDirsAsync, getLatestBackupPath, fetchJson, fetchText, readJsonBlob, readFileBlob, readBase64Blob, saveJsonFile, readJsonFile, writeJsonFile, ensureDirectory, clearDirectoryAsync, clearDirectory, fileExists, dirExists, isDirEmpty, ensureCopyFile, tryDeleteFile, writeTextFile, listFiles, listDirs, fileSize, dirSize, backupFile, restoreLatestBackup, renameFileBatch, renameFileRegex, renameFileAddPrefixSuffix, renameFileNormalizeCase, renameFilePadNumbers, documentIsFullScreen, isScreenFilled, requestFullScreen, exitFullScreen, isFullScreenMode, onFullScreenChange, offFullScreenChange, isJsonObject, arraySortPositions, formatBytes, addAiMarkerShortcut, extendObjType, reorderObjTypeOrder, cloneObjTypeOrder, countObj, checkObj, objTypeName, isObjType, objType, ruleOfThree, getSimplePerc, asyncReplace, getAge, formatCustomTimer, formatDayTimer, formatTimer, getTimeDuration, shuffleArray, toTitleCase, toTitleCaseLowerFirst, };
|
|
62
|
+
TinyColorValidator, TinyLoadingScreen, TinyElementObserver, TinySimpleDice, TinyNeedBar, TinyI18, TinyCookieConsent, TinyInventory, TinyInventoryTrader, TinyArrayPaginator, TinyAdvancedRaffle, TinyDayNightCycle, TinyGamepad, TinyTextarea, TinyNewWinEvents, TinyIframeEvents, TinyLocalStorage, TinyTimeout, TinyColorConverter, TinyClipboard, TinyTextRangeEditor, TinySmartScroller, UltraRandomMsgGen, TinyAfterScrollWatcher, TinyHtml, TinyNotifications, TinyDomReadyManager, TinyDragger, TinyDragDropDetector, TinyToastNotify, TinyNotifyCenter, TinyRateLimiter, ColorSafeStringify, TinyPromiseQueue, TinyLevelUp, getUserTimeFormat, getBrowserPings, isBrowserAgent, getBrowserCssPrefix, getDuckTyping, browserIs, isValidObj, createSingletonTask, waitForTrue, multiplyArrayBlocks, createCheckDestroyed, valMediaContentMetadata, valMediaContentMetadataPartial, parseMediaMetadata, extractMediaId3Tags, defuzzifyCentroid, trapezoid, diffArrayList, diffStrings, diffObjList, breakdownDuration, calculateMarketcap, compareMarketcap, getPercentage, areElsCollTop, areElsCollBottom, areElsCollLeft, areElsCollRight, areElsCollPerfTop, areElsCollPerfBottom, areElsCollPerfLeft, areElsCollPerfRight, areElsColliding, areElsPerfColliding, getElsColliding, getElsPerfColliding, getElsCollOverlap, getElsCollOverlapPos, getRectCenter, getElsRelativeCenterOffset, getElsCollDirDepth, getElsCollDetails, safeTextTrim, installWindowHiddenScript, genFibonacciSeq, isDirEmptyAsync, fileSizeAsync, dirSizeAsync, listFilesAsync, listDirsAsync, getLatestBackupPath, fetchJson, fetchText, readJsonBlob, readFileBlob, readBase64Blob, saveJsonFile, readJsonFile, writeJsonFile, ensureDirectory, clearDirectoryAsync, clearDirectory, fileExists, dirExists, isDirEmpty, ensureCopyFile, tryDeleteFile, writeTextFile, listFiles, listDirs, fileSize, dirSize, backupFile, restoreLatestBackup, renameFileBatch, renameFileRegex, renameFileAddPrefixSuffix, renameFileNormalizeCase, renameFilePadNumbers, documentIsFullScreen, isScreenFilled, requestFullScreen, exitFullScreen, isFullScreenMode, onFullScreenChange, offFullScreenChange, isJsonObject, arraySortPositions, formatBytes, addAiMarkerShortcut, extendObjType, reorderObjTypeOrder, cloneObjTypeOrder, countObj, checkObj, objTypeName, isObjType, objType, ruleOfThree, getSimplePerc, asyncReplace, getAge, formatCustomTimer, formatDayTimer, formatTimer, getTimeDuration, shuffleArray, toTitleCase, toTitleCaseLowerFirst, };
|
package/docs/v1/basics/clock.md
CHANGED
|
@@ -6,6 +6,7 @@ A versatile time utility module for JavaScript that helps you calculate and form
|
|
|
6
6
|
|
|
7
7
|
- ๐ข Calculate time differences in various units
|
|
8
8
|
- ๐งญ Format durations into clean, readable timer strings
|
|
9
|
+
- ๐ Locale-aware time cycle detection (12h vs 24h)
|
|
9
10
|
- ๐งฑ Support for years, months, days, hours, minutes, seconds **and milliseconds**
|
|
10
11
|
- ๐๏ธ Customizable output with template-based formatting
|
|
11
12
|
- ๐ ๏ธ Built-in presets for classic timer formats
|
|
@@ -15,6 +16,14 @@ A versatile time utility module for JavaScript that helps you calculate and form
|
|
|
15
16
|
|
|
16
17
|
## ๐ง API Overview
|
|
17
18
|
|
|
19
|
+
### ๐น `getUserTimeFormat()`
|
|
20
|
+
|
|
21
|
+
Detects the user's preferred time format (12-hour or 24-hour) based on the system's locale settings.
|
|
22
|
+
|
|
23
|
+
**Returns:** `number` โ `12` if the user's locale uses a 12-hour cycle, otherwise `24`.
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
18
27
|
### ๐น `getTimeDuration(timeData, durationType = 'asSeconds', now = null)`
|
|
19
28
|
|
|
20
29
|
Calculates how much time remains (or has passed) between now and a given time.
|
|
@@ -25,7 +34,7 @@ Calculates how much time remains (or has passed) between now and a given time.
|
|
|
25
34
|
| `durationType` | `string` | Format to return (`asMilliseconds`, `asSeconds`, `asMinutes`, etc.) |
|
|
26
35
|
| `now` | `Date` | Optional custom "now". Defaults to current time. |
|
|
27
36
|
|
|
28
|
-
**Returns:** `number
|
|
37
|
+
**Returns:** `number` โ The duration in the chosen unit.
|
|
29
38
|
|
|
30
39
|
---
|
|
31
40
|
|
|
@@ -93,15 +102,22 @@ This is useful when you want numeric values to build your own custom formats.
|
|
|
93
102
|
## ๐งช Examples
|
|
94
103
|
|
|
95
104
|
```js
|
|
105
|
+
// Detect user time preference
|
|
106
|
+
const timeFormat = getUserTimeFormat();
|
|
107
|
+
console.log(timeFormat); // 12 or 24
|
|
108
|
+
|
|
109
|
+
// Calculate remaining time
|
|
96
110
|
const futureTime = new Date(Date.now() + 10000);
|
|
97
111
|
const secondsLeft = getTimeDuration(futureTime, 'asSeconds');
|
|
98
112
|
|
|
99
113
|
console.log(formatTimer(secondsLeft)); // e.g. "00:00:09"
|
|
100
114
|
console.log(formatDayTimer(172800 + 3661)); // "2d 01:01:01"
|
|
101
115
|
|
|
116
|
+
// Custom formatting
|
|
102
117
|
const custom = formatCustomTimer(3600 * 26 + 61, 'days', '{days}d {hours}h {minutes}m {seconds}s');
|
|
103
118
|
console.log(custom); // "1d 2h 1m 1s"
|
|
104
119
|
|
|
120
|
+
// Detailed breakdown
|
|
105
121
|
const breakdown = breakdownDuration(987654321, 'years');
|
|
106
122
|
console.log(breakdown);
|
|
107
123
|
// {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tiny-essentials",
|
|
3
|
-
"version": "1.28.
|
|
3
|
+
"version": "1.28.12",
|
|
4
4
|
"description": "Collection of small, essential scripts designed to be used across various projects. These simple utilities are crafted for speed, ease of use, and versatility.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"tiny-essentials-fork": "./TinyFork.mjs"
|