diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 67fd2eb..2522e90 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -135,13 +135,3 @@ pages: paths: - public allow_failure: true - -windowsCompatibility: - image: stefanscherer/node-windows:10-build-tools - stage: metadata - script: - - npm install & npm test - coverage: /\d+.?\d+?\%\s*coverage/ - tags: - - windows - allow_failure: true diff --git a/package-lock.json b/package-lock.json index 33044b6..7924b4e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -251,14 +251,14 @@ } }, "@types/luxon": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/@types/luxon/-/luxon-1.4.0.tgz", - "integrity": "sha512-jECW+lbzPICLGqN/dBdX6Lwn5s84okwM2EVjcYim7hkh5+Ebej8kjxY7InBlsORNjGe8v7lPpd/88a0qkoEcuA==" + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/@types/luxon/-/luxon-1.4.1.tgz", + "integrity": "sha512-mYv/gbkOJ40CDgR8st5sosfFNrJncdlkpdzQSNRdU86UQg3oWWmll4AO/7B8F5FlBC6YrIXqXDSnkoCBqo+uMA==" }, "@types/node": { - "version": "10.12.0", - "resolved": "https://registry.npmjs.org/@types/node/-/node-10.12.0.tgz", - "integrity": "sha512-3TUHC3jsBAB7qVRGxT6lWyYo2v96BMmD2PTcl47H25Lu7UXtFH/2qqmKiVrnel6Ne//0TFYf6uvNX+HW2FRkLQ==", + "version": "10.12.10", + "resolved": "https://registry.npmjs.org/@types/node/-/node-10.12.10.tgz", + "integrity": "sha512-8xZEYckCbUVgK8Eg7lf5Iy4COKJ5uXlnIOnePN0WUwSQggy9tolM+tDJf7wMOnT/JT/W9xDYIaYggt3mRV2O5w==", "dev": true }, "@types/vinyl": { @@ -718,9 +718,9 @@ "dev": true }, "luxon": { - "version": "1.4.3", - "resolved": "https://registry.npmjs.org/luxon/-/luxon-1.4.3.tgz", - "integrity": "sha512-hujVJ+Q2RnaIiHKAupwusgpHXYICxzXJNoPkqkGIfmP+lLZWFTD6gEP+URRs/vh5gI1KwfMimVrzM9309RE0tA==" + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/luxon/-/luxon-1.8.0.tgz", + "integrity": "sha512-F742cYUYB7X+LXY3cIn6THZUBqRBjeAvF+CWE2i3+eKcv2bzsCsnRsBYL8Qrqzp1dfs6HsVcSjfKt2RcrtUElw==" }, "make-error": { "version": "1.3.4", @@ -1005,9 +1005,9 @@ } }, "tslint-config-prettier": { - "version": "1.15.0", - "resolved": "https://registry.npmjs.org/tslint-config-prettier/-/tslint-config-prettier-1.15.0.tgz", - "integrity": "sha512-06CgrHJxJmNYVgsmeMoa1KXzQRoOdvfkqnJth6XUkNeOz707qxN0WfxfhYwhL5kXHHbYJRby2bqAPKwThlZPhw==", + "version": "1.16.0", + "resolved": "https://registry.npmjs.org/tslint-config-prettier/-/tslint-config-prettier-1.16.0.tgz", + "integrity": "sha512-zu6RAcpBtqdvhT6KpBh9kRPYATjOf9BnRi718kNqVKFjEgSE4rFrPprFju1YJrkOa3RbtbWI1ZSuLd2NBX1MDw==", "dev": true }, "tsutils": { diff --git a/package.json b/package.json index d273604..736e4ae 100644 --- a/package.json +++ b/package.json @@ -16,13 +16,13 @@ "@gitzone/tsrun": "^1.1.13", "@gitzone/tstest": "^1.0.15", "@pushrocks/tapbundle": "^3.0.7", - "@types/node": "^10.12.0", + "@types/node": "^10.12.10", "tslint": "^5.11.0", - "tslint-config-prettier": "^1.15.0" + "tslint-config-prettier": "^1.16.0" }, "dependencies": { "@pushrocks/smartpromise": "^2.0.5", - "@types/luxon": "^1.4.0", - "luxon": "^1.4.3" + "@types/luxon": "^1.4.1", + "luxon": "^1.8.0" } -} +} \ No newline at end of file diff --git a/test/test.date.ts b/test/test.date.ts index 2a439a8..5e90f43 100644 --- a/test/test.date.ts +++ b/test/test.date.ts @@ -8,8 +8,12 @@ tap.test('should create a valid JavaScript Date from European TimeStamp', async }); tap.test('should create a date and time with European Format', async () => { - const extendedDate = smarttime.ExtendedDate.fromEuropeanDateAndTime('9.8.2018', '08:00:00', 'Europe/Berlin'); + const extendedDate = smarttime.ExtendedDate.fromEuropeanDateAndTime( + '9.8.2018', + '08:00:00', + 'Europe/Berlin' + ); console.log(extendedDate); -}) +}); tap.start(); diff --git a/ts/smarttime.classes.date.ts b/ts/smarttime.classes.date.ts index defd4d3..100a3a8 100644 --- a/ts/smarttime.classes.date.ts +++ b/ts/smarttime.classes.date.ts @@ -24,13 +24,12 @@ export class ExtendedDate extends Date { const sliceDate = (dateString: string) => { return `0${dateString}`.slice(-2); }; - const dateTimeString = `${dateArray[3]}-${sliceDate(dateArray[2])}-${sliceDate(dateArray[1])}T${timeArg}`; - const luxonDate = plugins.luxon.DateTime.fromISO( - dateTimeString, - { - zone: zoneArg - } - ); + const dateTimeString = `${dateArray[3]}-${sliceDate(dateArray[2])}-${sliceDate( + dateArray[1] + )}T${timeArg}`; + const luxonDate = plugins.luxon.DateTime.fromISO(dateTimeString, { + zone: zoneArg + }); const unixMilli = luxonDate.toMillis(); return new ExtendedDate(unixMilli); } diff --git a/ts/smarttime.classes.timer.ts b/ts/smarttime.classes.timer.ts index 938a823..e17c1bd 100644 --- a/ts/smarttime.classes.timer.ts +++ b/ts/smarttime.classes.timer.ts @@ -70,6 +70,14 @@ export class Timer { this.currentTimeout = setTimeout(() => { this.completedDeferred.resolve(); }, this.timeLeft); + } else { + throw new Error('timer has NOT been started before. Please use .start() instead'); } } + + public reset() { + this.pause(); + this.startedAt = null; + this.pausedAt = null; + } } diff --git a/tslint.json b/tslint.json index 364f009..d4ea2e9 100644 --- a/tslint.json +++ b/tslint.json @@ -1,6 +1,17 @@ { - "extends": [ - "tslint:latest", - "tslint-config-prettier" - ] + "extends": ["tslint:latest", "tslint-config-prettier"], + "rules": { + "semicolon": [true, "always"], + "no-console": false, + "ordered-imports": false, + "object-literal-sort-keys": false, + "member-ordering": { + "options":{ + "order": [ + "static-method" + ] + } + } + }, + "defaultSeverity": "warning" }