@ancon/wildcat-utils 1.41.12 → 1.41.14

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.12",
3
+ "version": "1.41.14",
4
4
  "private": false,
5
5
  "main": "index.js",
6
6
  "module": "index.mjs",
@@ -981,10 +981,10 @@
981
981
  "require": "./tables/index.js",
982
982
  "types": "./tables/index.d.ts"
983
983
  },
984
- "./time/addDurationToTimeSpan": {
985
- "import": "./time/addDurationToTimeSpan.mjs",
986
- "require": "./time/addDurationToTimeSpan.js",
987
- "types": "./time/addDurationToTimeSpan.d.ts"
984
+ "./time/getEndTimeSpanOfTimePeriod": {
985
+ "import": "./time/getEndTimeSpanOfTimePeriod.mjs",
986
+ "require": "./time/getEndTimeSpanOfTimePeriod.js",
987
+ "types": "./time/getEndTimeSpanOfTimePeriod.d.ts"
988
988
  },
989
989
  "./time/getNextTenthMinute": {
990
990
  "import": "./time/getNextTenthMinute.mjs",
@@ -0,0 +1,14 @@
1
+ declare type TimePeriod = {
2
+ from: string;
3
+ duration: string;
4
+ };
5
+ declare type TimeFormat = 'HH:mm' | 'HH:mm:ss';
6
+ /**
7
+ * This function calculates the end time of a time period with the duration.
8
+ *
9
+ * @param timePeriod The time period object with `from` and `duration`.
10
+ * @param format The format of the time. Default is `HH:mm`.
11
+ * @returns The end time of the time period.
12
+ */
13
+ export default function getEndTimeSpanOfTimePeriod(timePeriod: TimePeriod, format?: TimeFormat): string;
14
+ export {};
@@ -0,0 +1 @@
1
+ "use strict";const u=require("moment"),n=require("./getTimeSpanParts.js");function c(s,m="HH:mm"){const{from:r,duration:i}=s,e=n(r),t=n(i),o=u().startOf("day").hour(e.hours).minute(e.minutes).second(e.seconds??0).millisecond(0);return o.add({hours:t.hours,minutes:t.minutes,seconds:t.seconds}),o.format(m)}module.exports=c;
@@ -0,0 +1,13 @@
1
+ import d from "moment";
2
+ import m from "./getTimeSpanParts.mjs";
3
+ function c(n, s = "HH:mm") {
4
+ const { from: r, duration: i } = n, o = m(r), t = m(i), e = d().startOf("day").hour(o.hours).minute(o.minutes).second(o.seconds ?? 0).millisecond(0);
5
+ return e.add({
6
+ hours: t.hours,
7
+ minutes: t.minutes,
8
+ seconds: t.seconds
9
+ }), e.format(s);
10
+ }
11
+ export {
12
+ c as default
13
+ };
package/time/index.d.ts CHANGED
@@ -2,5 +2,5 @@ import toMinutes from './toMinutes';
2
2
  import getNextTenthMinute from './getNextTenthMinute';
3
3
  import getPrevNthMinute from './getPrevNthMinute';
4
4
  import getTimeSpanParts from './getTimeSpanParts';
5
- import addDurationToTimeSpan from './addDurationToTimeSpan';
6
- export { toMinutes, getNextTenthMinute, getTimeSpanParts, getPrevNthMinute, addDurationToTimeSpan, };
5
+ import getEndTimeSpanOfTimePeriod from './getEndTimeSpanOfTimePeriod';
6
+ export { toMinutes, getNextTenthMinute, getTimeSpanParts, getPrevNthMinute, getEndTimeSpanOfTimePeriod, };
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("./addDurationToTimeSpan.js");require("moment");exports.toMinutes=e;exports.getNextTenthMinute=t;exports.getPrevNthMinute=i;exports.getTimeSpanParts=r;exports.addDurationToTimeSpan=n;
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;
package/time/index.mjs CHANGED
@@ -1,13 +1,13 @@
1
- import { default as o } from "./toMinutes.mjs";
1
+ import { default as a } from "./toMinutes.mjs";
2
2
  import { default as f } from "./getNextTenthMinute.mjs";
3
- import { default as m } from "./getPrevNthMinute.mjs";
4
- import { default as d } from "./getTimeSpanParts.mjs";
5
- import { default as n } from "./addDurationToTimeSpan.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";
6
6
  import "moment";
7
7
  export {
8
- n as addDurationToTimeSpan,
8
+ n as getEndTimeSpanOfTimePeriod,
9
9
  f as getNextTenthMinute,
10
- m as getPrevNthMinute,
11
- d as getTimeSpanParts,
12
- o as toMinutes
10
+ i as getPrevNthMinute,
11
+ u as getTimeSpanParts,
12
+ a as toMinutes
13
13
  };
@@ -1,9 +0,0 @@
1
- /**
2
- * Function to add duration to a time span
3
- *
4
- * @param timeSpan The time span to add the duration
5
- * @param duration The duration to add
6
- * @returns The time span with the duration
7
- */
8
- export default function addDurationToTimeSpan(timeSpan: string, // 'HH:mm:ss'
9
- duration: string): string;
@@ -1 +0,0 @@
1
- "use strict";const r=require("moment"),o=require("./getTimeSpanParts.js");function i(n,m){const e=o(n),s=o(m),t=r().startOf("day").hour(e.hours).minute(e.minutes).second(e.seconds??0).millisecond(0);return t.add({hours:s.hours,minutes:s.minutes,seconds:s.seconds}),t.format("HH:mm:ss")}module.exports=i;
@@ -1,13 +0,0 @@
1
- import r from "moment";
2
- import s from "./getTimeSpanParts.mjs";
3
- function u(e, n) {
4
- const o = s(e), t = s(n), m = r().startOf("day").hour(o.hours).minute(o.minutes).second(o.seconds ?? 0).millisecond(0);
5
- return m.add({
6
- hours: t.hours,
7
- minutes: t.minutes,
8
- seconds: t.seconds
9
- }), m.format("HH:mm:ss");
10
- }
11
- export {
12
- u as default
13
- };