Compare commits

..

4 Commits

Author SHA1 Message Date
Darius
10501bc0a9 1.0.4 2025-11-17 23:48:41 +01:00
Darius
f016d7a01c Generic Commit; Most likely a fix or small feature 2025-11-17 23:48:37 +01:00
Darius
fee4ca327a 1.0.3 2025-11-17 23:47:48 +01:00
Darius
60390fcbdf 1.0.2 2025-11-17 23:47:36 +01:00
5 changed files with 41 additions and 3 deletions

8
dist/timespan.d.ts vendored Normal file
View File

@@ -0,0 +1,8 @@
export declare class TimeSpan {
private start;
private end;
constructor(timeSpanStr: string);
private parseTime;
contains(timestamp?: number): boolean;
}
//# sourceMappingURL=timespan.d.ts.map

1
dist/timespan.d.ts.map vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"timespan.d.ts","sourceRoot":"","sources":["../src/timespan.ts"],"names":[],"mappings":"AAAA,qBAAa,QAAQ;IACnB,OAAO,CAAC,KAAK,CAAqC;IAClD,OAAO,CAAC,GAAG,CAAqC;gBAEpC,WAAW,EAAE,MAAM;IAM/B,OAAO,CAAC,SAAS;IAKjB,QAAQ,CAAC,SAAS,GAAE,MAAmB,GAAG,OAAO;CAgBlD"}

29
dist/timespan.js vendored Normal file
View File

@@ -0,0 +1,29 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.TimeSpan = void 0;
class TimeSpan {
constructor(timeSpanStr) {
const [startStr, endStr] = timeSpanStr.split("-");
this.start = this.parseTime(startStr);
this.end = this.parseTime(endStr);
}
parseTime(timeStr) {
const [hours, minutes] = timeStr.split(":").map(Number);
return { hours, minutes };
}
contains(timestamp = Date.now()) {
const date = new Date(timestamp);
const hours = date.getHours();
const minutes = date.getMinutes();
const currentMinutes = hours * 60 + minutes;
const startMinutes = this.start.hours * 60 + this.start.minutes;
const endMinutes = this.end.hours * 60 + this.end.minutes;
if (startMinutes > endMinutes) {
return currentMinutes >= startMinutes || currentMinutes < endMinutes;
}
else {
return currentMinutes >= startMinutes && currentMinutes < endMinutes;
}
}
}
exports.TimeSpan = TimeSpan;

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{ {
"name": "@dpu/shared", "name": "@dpu/shared",
"version": "1.0.1", "version": "1.0.4",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "@dpu/shared", "name": "@dpu/shared",
"version": "1.0.1", "version": "1.0.4",
"dependencies": { "dependencies": {
"axios": "^1.7.9", "axios": "^1.7.9",
"chalk": "^5.6.2" "chalk": "^5.6.2"

View File

@@ -1,6 +1,6 @@
{ {
"name": "@dpu/shared", "name": "@dpu/shared",
"version": "1.0.1", "version": "1.0.4",
"description": "", "description": "",
"main": "dist/index.js", "main": "dist/index.js",
"types": "dist/index.d.ts", "types": "dist/index.d.ts",