@react-pakistan/util-functions 1.25.10 → 1.25.11

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 @@
1
+ export declare const formatSecs: (sec: number) => string;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.formatSecs = void 0;
4
+ var formatSecs = function (sec) {
5
+ if (sec >= 0) {
6
+ var hours = Math.floor(sec / 3600);
7
+ var minutes = Math.floor((sec % 3600) / 60);
8
+ var secs = sec % 60;
9
+ return "".concat(hours, "h ").concat(minutes, "m ").concat(secs, "s");
10
+ }
11
+ else {
12
+ // For negative seconds, convert to negative hours and positive minutes/seconds
13
+ var absSec = Math.abs(sec);
14
+ var hours = -Math.ceil(absSec / 3600);
15
+ var remaining = absSec % 3600;
16
+ var minutes = Math.floor((3600 - remaining) / 60) % 60;
17
+ var secs = (60 - (absSec % 60)) % 60;
18
+ return "".concat(hours, "h ").concat(minutes, "m ").concat(secs, "s");
19
+ }
20
+ };
21
+ exports.formatSecs = formatSecs;
@@ -15,6 +15,7 @@ export * from './format-date';
15
15
  export * from './format-number';
16
16
  export * from './format-phone';
17
17
  export * from './format-pricing';
18
+ export * from './format-secs';
18
19
  export * from './format-time';
19
20
  export * from './full-month-range';
20
21
  export * from './full-year-range';
package/general/index.js CHANGED
@@ -31,6 +31,7 @@ __exportStar(require("./format-date"), exports);
31
31
  __exportStar(require("./format-number"), exports);
32
32
  __exportStar(require("./format-phone"), exports);
33
33
  __exportStar(require("./format-pricing"), exports);
34
+ __exportStar(require("./format-secs"), exports);
34
35
  __exportStar(require("./format-time"), exports);
35
36
  __exportStar(require("./full-month-range"), exports);
36
37
  __exportStar(require("./full-year-range"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-pakistan/util-functions",
3
- "version": "1.25.10",
3
+ "version": "1.25.11",
4
4
  "description": "A library of all util functions",
5
5
  "main": "index.js",
6
6
  "scripts": {