@ancon/wildcat-utils 1.41.17 → 1.41.19
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/license/getLicenseUIState.js +1 -1
- package/license/getLicenseUIState.mjs +6 -15
- package/package.json +11 -1
- package/time/formatTimeSpan.d.ts +9 -0
- package/time/formatTimeSpan.js +1 -0
- package/time/formatTimeSpan.mjs +7 -0
- package/time/getDurationBetweenTimeSpans.d.ts +11 -0
- package/time/getDurationBetweenTimeSpans.js +1 -0
- package/time/getDurationBetweenTimeSpans.mjs +13 -0
- package/time/index.d.ts +3 -1
- package/time/index.js +1 -1
- package/time/index.mjs +8 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const r=require("moment"),e=require("@ancon/wildcat-types"),t=require("./types.js");function c(i,n,s=10){return(i&e.LicenseStatus.Terminated)===e.LicenseStatus.Terminated?t.LicenseUIState.Terminated:(i&e.LicenseStatus.Expired)===e.LicenseStatus.Expired?t.LicenseUIState.Expired:(i&e.LicenseStatus.Extended)===e.LicenseStatus.Extended?t.LicenseUIState.Extended:n&&r(n).diff(r(),"day")<=s?t.LicenseUIState.AboutToExpire:t.LicenseUIState.Valid}module.exports=c;
|
|
@@ -1,18 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { LicenseStatus as
|
|
3
|
-
import { LicenseUIState as
|
|
4
|
-
function
|
|
5
|
-
|
|
6
|
-
case t.Expired:
|
|
7
|
-
return e.Expired;
|
|
8
|
-
case t.Extended:
|
|
9
|
-
return e.Extended;
|
|
10
|
-
case t.Terminated:
|
|
11
|
-
return e.Terminated;
|
|
12
|
-
default:
|
|
13
|
-
return r && i(r).diff(i(), "day") <= o ? e.AboutToExpire : e.Valid;
|
|
14
|
-
}
|
|
1
|
+
import n from "moment";
|
|
2
|
+
import { LicenseStatus as e } from "@ancon/wildcat-types";
|
|
3
|
+
import { LicenseUIState as r } from "./types.mjs";
|
|
4
|
+
function a(i, t, o = 10) {
|
|
5
|
+
return (i & e.Terminated) === e.Terminated ? r.Terminated : (i & e.Expired) === e.Expired ? r.Expired : (i & e.Extended) === e.Extended ? r.Extended : t && n(t).diff(n(), "day") <= o ? r.AboutToExpire : r.Valid;
|
|
15
6
|
}
|
|
16
7
|
export {
|
|
17
|
-
|
|
8
|
+
a as default
|
|
18
9
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ancon/wildcat-utils",
|
|
3
|
-
"version": "1.41.
|
|
3
|
+
"version": "1.41.19",
|
|
4
4
|
"private": false,
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "index.mjs",
|
|
@@ -986,6 +986,16 @@
|
|
|
986
986
|
"require": "./time/createTimeSpan.js",
|
|
987
987
|
"types": "./time/createTimeSpan.d.ts"
|
|
988
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
|
+
},
|
|
989
999
|
"./time/getEndTimeSpanOfTimePeriod": {
|
|
990
1000
|
"import": "./time/getEndTimeSpanOfTimePeriod.mjs",
|
|
991
1001
|
"require": "./time/getEndTimeSpanOfTimePeriod.js",
|
|
@@ -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,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
|
+
};
|
package/time/index.d.ts
CHANGED
|
@@ -4,4 +4,6 @@ import getPrevNthMinute from './getPrevNthMinute';
|
|
|
4
4
|
import getTimeSpanParts from './getTimeSpanParts';
|
|
5
5
|
import getEndTimeSpanOfTimePeriod from './getEndTimeSpanOfTimePeriod';
|
|
6
6
|
import createTimeSpan from './createTimeSpan';
|
|
7
|
-
|
|
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"),
|
|
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,15 +1,19 @@
|
|
|
1
1
|
import { default as r } from "./toMinutes.mjs";
|
|
2
2
|
import { default as f } from "./getNextTenthMinute.mjs";
|
|
3
3
|
import { default as p } from "./getPrevNthMinute.mjs";
|
|
4
|
-
import { default as
|
|
5
|
-
import { default as
|
|
4
|
+
import { default as n } from "./getTimeSpanParts.mjs";
|
|
5
|
+
import { default as s } from "./getEndTimeSpanOfTimePeriod.mjs";
|
|
6
6
|
import { default as x } from "./createTimeSpan.mjs";
|
|
7
|
+
import { default as T } from "./formatTimeSpan.mjs";
|
|
8
|
+
import { default as S } from "./getDurationBetweenTimeSpans.mjs";
|
|
7
9
|
import "moment";
|
|
8
10
|
export {
|
|
9
11
|
x as createTimeSpan,
|
|
10
|
-
|
|
12
|
+
T as formatTimeSpan,
|
|
13
|
+
S as getDurationBetweenTimeSpans,
|
|
14
|
+
s as getEndTimeSpanOfTimePeriod,
|
|
11
15
|
f as getNextTenthMinute,
|
|
12
16
|
p as getPrevNthMinute,
|
|
13
|
-
|
|
17
|
+
n as getTimeSpanParts,
|
|
14
18
|
r as toMinutes
|
|
15
19
|
};
|