@ancon/wildcat-utils 1.41.16 → 1.41.18

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ancon/wildcat-utils",
3
- "version": "1.41.16",
3
+ "version": "1.41.18",
4
4
  "private": false,
5
5
  "main": "index.js",
6
6
  "module": "index.mjs",
@@ -981,6 +981,21 @@
981
981
  "require": "./tables/index.js",
982
982
  "types": "./tables/index.d.ts"
983
983
  },
984
+ "./time/createTimeSpan": {
985
+ "import": "./time/createTimeSpan.mjs",
986
+ "require": "./time/createTimeSpan.js",
987
+ "types": "./time/createTimeSpan.d.ts"
988
+ },
989
+ "./time/formatTimeSpan": {
990
+ "import": "./time/formatTimeSpan.mjs",
991
+ "require": "./time/formatTimeSpan.js",
992
+ "types": "./time/formatTimeSpan.d.ts"
993
+ },
994
+ "./time/getDurationBetweenTimeSpans": {
995
+ "import": "./time/getDurationBetweenTimeSpans.mjs",
996
+ "require": "./time/getDurationBetweenTimeSpans.js",
997
+ "types": "./time/getDurationBetweenTimeSpans.d.ts"
998
+ },
984
999
  "./time/getEndTimeSpanOfTimePeriod": {
985
1000
  "import": "./time/getEndTimeSpanOfTimePeriod.mjs",
986
1001
  "require": "./time/getEndTimeSpanOfTimePeriod.js",
@@ -1011,6 +1026,11 @@
1011
1026
  "require": "./time/toMinutes.js",
1012
1027
  "types": "./time/toMinutes.d.ts"
1013
1028
  },
1029
+ "./time/types": {
1030
+ "import": "./time/types.mjs",
1031
+ "require": "./time/types.js",
1032
+ "types": "./time/types.d.ts"
1033
+ },
1014
1034
  "./user/getCustomerAddressFromGeocoderResult": {
1015
1035
  "import": "./user/getCustomerAddressFromGeocoderResult.mjs",
1016
1036
  "require": "./user/getCustomerAddressFromGeocoderResult.js",
@@ -0,0 +1,9 @@
1
+ import { TimeFormat, TimeSpanParts } from './types';
2
+ /**
3
+ * This function creates a time span with the given time span parts.
4
+ *
5
+ * @param timeSpanParts The time span parts object with `hours`, `minutes`, and `seconds`.
6
+ * @param format The format of the time. Default is `HH:mm`.
7
+ * @returns The formatted time span.
8
+ */
9
+ export default function createTimeSpan(timeSpanParts: TimeSpanParts, format?: TimeFormat): string;
@@ -0,0 +1 @@
1
+ "use strict";const n=require("moment");function r(t,m="HH:mm"){const e=n("00:00:00","HH:mm:ss");return e.add(t),e.format(m)}module.exports=r;
@@ -0,0 +1,8 @@
1
+ import o from "moment";
2
+ function n(t, e = "HH:mm") {
3
+ const m = o("00:00:00", "HH:mm:ss");
4
+ return m.add(t), m.format(e);
5
+ }
6
+ export {
7
+ n as default
8
+ };
@@ -0,0 +1,9 @@
1
+ import { TimeFormat } from './types';
2
+ /**
3
+ * This function formats the time span with the given format.
4
+ *
5
+ * @param timeSpan The time span to format.
6
+ * @param format The format of the time. Default is `HH:mm`
7
+ * @returns The formatted time span.
8
+ */
9
+ export default function formatTimeSpan(timeSpan: string, format?: TimeFormat): string;
@@ -0,0 +1 @@
1
+ "use strict";const r=require("moment");function e(m,t="HH:mm"){return r(m,"HH:mm:ss").format(t)}module.exports=e;
@@ -0,0 +1,7 @@
1
+ import o from "moment";
2
+ function a(m, t = "HH:mm") {
3
+ return o(m, "HH:mm:ss").format(t);
4
+ }
5
+ export {
6
+ a as default
7
+ };
@@ -0,0 +1,11 @@
1
+ import { TimeFormat } from './types';
2
+ /**
3
+ * This function gets the duration between `from` and `to` time spans.
4
+ * If the `to` time span is before the `from` time span, it will return the duration of the next day.
5
+ *
6
+ * @param fromTimeSpan The start time span.
7
+ * @param toTimeSpan The end time span.
8
+ * @param format The format of the time. Default is `HH:mm`.
9
+ * @returns The duration time span between the two time spans.
10
+ */
11
+ export default function getDurationBetweenTimeSpans(fromTimeSpan: string, toTimeSpan: string, format?: TimeFormat): string;
@@ -0,0 +1 @@
1
+ "use strict";const t=require("moment"),u=require("./createTimeSpan.js");function a(n,s,o="HH:mm"){const m=t(n,"HH:mm:ss"),i=t(s,"HH:mm:ss"),e=t.duration(i.diff(m)),r={hours:e.hours(),minutes:e.minutes(),seconds:e.seconds()};return u(r,o)}module.exports=a;
@@ -0,0 +1,13 @@
1
+ import e from "moment";
2
+ import a from "./createTimeSpan.mjs";
3
+ function d(o, m, n = "HH:mm") {
4
+ const s = e(o, "HH:mm:ss"), r = e(m, "HH:mm:ss"), t = e.duration(r.diff(s)), i = {
5
+ hours: t.hours(),
6
+ minutes: t.minutes(),
7
+ seconds: t.seconds()
8
+ };
9
+ return a(i, n);
10
+ }
11
+ export {
12
+ d as default
13
+ };
@@ -1,9 +1,2 @@
1
- export default function getTimeSpanParts(timeSpan: string): {
2
- hours: number;
3
- minutes: number;
4
- seconds?: undefined;
5
- } | {
6
- hours: number;
7
- minutes: number;
8
- seconds: number;
9
- };
1
+ import { TimeSpanParts } from './types';
2
+ export default function getTimeSpanParts(timeSpan: string): TimeSpanParts;
package/time/index.d.ts CHANGED
@@ -3,4 +3,7 @@ import getNextTenthMinute from './getNextTenthMinute';
3
3
  import getPrevNthMinute from './getPrevNthMinute';
4
4
  import getTimeSpanParts from './getTimeSpanParts';
5
5
  import getEndTimeSpanOfTimePeriod from './getEndTimeSpanOfTimePeriod';
6
- export { toMinutes, getNextTenthMinute, getTimeSpanParts, getPrevNthMinute, getEndTimeSpanOfTimePeriod, };
6
+ import createTimeSpan from './createTimeSpan';
7
+ import formatTimeSpan from './formatTimeSpan';
8
+ import getDurationBetweenTimeSpans from './getDurationBetweenTimeSpans';
9
+ export { toMinutes, getNextTenthMinute, getTimeSpanParts, getPrevNthMinute, getEndTimeSpanOfTimePeriod, createTimeSpan, formatTimeSpan, getDurationBetweenTimeSpans, };
package/time/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./toMinutes.js"),t=require("./getNextTenthMinute.js"),i=require("./getPrevNthMinute.js"),r=require("./getTimeSpanParts.js"),n=require("./getEndTimeSpanOfTimePeriod.js");require("moment");exports.toMinutes=e;exports.getNextTenthMinute=t;exports.getPrevNthMinute=i;exports.getTimeSpanParts=r;exports.getEndTimeSpanOfTimePeriod=n;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./toMinutes.js"),t=require("./getNextTenthMinute.js"),i=require("./getPrevNthMinute.js"),n=require("./getTimeSpanParts.js"),r=require("./getEndTimeSpanOfTimePeriod.js"),m=require("./createTimeSpan.js"),a=require("./formatTimeSpan.js"),o=require("./getDurationBetweenTimeSpans.js");require("moment");exports.toMinutes=e;exports.getNextTenthMinute=t;exports.getPrevNthMinute=i;exports.getTimeSpanParts=n;exports.getEndTimeSpanOfTimePeriod=r;exports.createTimeSpan=m;exports.formatTimeSpan=a;exports.getDurationBetweenTimeSpans=o;
package/time/index.mjs CHANGED
@@ -1,13 +1,19 @@
1
- import { default as a } from "./toMinutes.mjs";
1
+ import { default as r } from "./toMinutes.mjs";
2
2
  import { default as f } from "./getNextTenthMinute.mjs";
3
- import { default as i } from "./getPrevNthMinute.mjs";
4
- import { default as u } from "./getTimeSpanParts.mjs";
5
- import { default as n } from "./getEndTimeSpanOfTimePeriod.mjs";
3
+ import { default as p } from "./getPrevNthMinute.mjs";
4
+ import { default as n } from "./getTimeSpanParts.mjs";
5
+ import { default as s } from "./getEndTimeSpanOfTimePeriod.mjs";
6
+ import { default as x } from "./createTimeSpan.mjs";
7
+ import { default as T } from "./formatTimeSpan.mjs";
8
+ import { default as S } from "./getDurationBetweenTimeSpans.mjs";
6
9
  import "moment";
7
10
  export {
8
- n as getEndTimeSpanOfTimePeriod,
11
+ x as createTimeSpan,
12
+ T as formatTimeSpan,
13
+ S as getDurationBetweenTimeSpans,
14
+ s as getEndTimeSpanOfTimePeriod,
9
15
  f as getNextTenthMinute,
10
- i as getPrevNthMinute,
11
- u as getTimeSpanParts,
12
- a as toMinutes
16
+ p as getPrevNthMinute,
17
+ n as getTimeSpanParts,
18
+ r as toMinutes
13
19
  };
@@ -0,0 +1,6 @@
1
+ export declare type TimeSpanParts = {
2
+ hours: number;
3
+ minutes: number;
4
+ seconds?: number;
5
+ };
6
+ export declare type TimeFormat = 'HH:mm' | 'HH:mm:ss';
package/time/types.js ADDED
@@ -0,0 +1 @@
1
+ "use strict";
package/time/types.mjs ADDED
@@ -0,0 +1 @@
1
+