Compare commits

...

4 Commits

Author SHA1 Message Date
f161f71c4e 3.0.0 2018-10-17 01:42:36 +02:00
ed1f79caa4 BREAKING CHANGE(deps): remove moment and use luxon 2018-10-17 01:42:36 +02:00
539bbc1568 2.0.2 2018-07-13 00:03:08 +02:00
7d4bf05289 fix(dependencies): leaner dependencies 2018-07-13 00:03:08 +02:00
11 changed files with 902 additions and 190 deletions

View File

@ -26,6 +26,7 @@ mirror:
snyk: snyk:
stage: security stage: security
script: script:
- npmci npm prepare
- npmci command npm install -g snyk - npmci command npm install -g snyk
- npmci command npm install --ignore-scripts - npmci command npm install --ignore-scripts
- npmci command snyk test - npmci command snyk test
@ -39,6 +40,7 @@ snyk:
testLEGACY: testLEGACY:
stage: test stage: test
script: script:
- npmci npm prepare
- npmci node install legacy - npmci node install legacy
- npmci npm install - npmci npm install
- npmci npm test - npmci npm test
@ -51,6 +53,7 @@ testLEGACY:
testLTS: testLTS:
stage: test stage: test
script: script:
- npmci npm prepare
- npmci node install lts - npmci node install lts
- npmci npm install - npmci npm install
- npmci npm test - npmci npm test
@ -62,6 +65,7 @@ testLTS:
testSTABLE: testSTABLE:
stage: test stage: test
script: script:
- npmci npm prepare
- npmci node install stable - npmci node install stable
- npmci npm install - npmci npm install
- npmci npm test - npmci npm test
@ -117,8 +121,10 @@ pages:
image: hosttoday/ht-docker-node:npmci image: hosttoday/ht-docker-node:npmci
stage: metadata stage: metadata
script: script:
- npmci command npm install -g npmpage - npmci command npm install -g typedoc typescript
- npmci command npmpage - npmci npm prepare
- npmci npm install
- npmci command typedoc --module "commonjs" --target "ES2016" --out public/ ts/
tags: tags:
- docker - docker
- notpriv - notpriv
@ -128,3 +134,14 @@ pages:
expire_in: 1 week expire_in: 1 week
paths: paths:
- public - 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

View File

@ -1,8 +1,6 @@
{ {
"npmci": { "npmci": {
"npmGlobalTools": [ "npmGlobalTools": [],
"npmts"
],
"npmAccessLevel": "public" "npmAccessLevel": "public"
} }
} }

998
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,24 +1,28 @@
{ {
"name": "@pushrocks/smarttime", "name": "@pushrocks/smarttime",
"private": false, "private": false,
"version": "2.0.1", "version": "3.0.0",
"description": "handle timeformats in smart ways", "description": "handle timeformats in smart ways",
"main": "dist/index.js", "main": "dist/index.js",
"typings": "dist/index.d.ts", "typings": "dist/index.d.ts",
"author": "Lossless GmbH", "author": "Lossless GmbH",
"license": "MIT", "license": "MIT",
"scripts": { "scripts": {
"test": "(tsrun ./test/test.ts)", "test": "(tstest ./test/)",
"build": "(npmts)" "build": "(tsbuild)"
}, },
"devDependencies": { "devDependencies": {
"@gitzone/tsrun": "^1.0.5", "@gitzone/tsbuild": "^2.0.22",
"@types/node": "^9.4.7", "@gitzone/tsrun": "^1.1.13",
"tapbundle": "^2.0.0" "@gitzone/tstest": "^1.0.15",
"@pushrocks/tapbundle": "^3.0.7",
"@types/node": "^10.12.0",
"tslint": "^5.11.0",
"tslint-config-prettier": "^1.15.0"
}, },
"dependencies": { "dependencies": {
"moment": "^2.21.0", "@pushrocks/smartpromise": "^2.0.5",
"smartdelay": "^1.0.4", "@types/luxon": "^1.4.0",
"smartq": "^1.1.6" "luxon": "^1.4.3"
} }
} }

10
test/test.date.ts Normal file
View File

@ -0,0 +1,10 @@
import { expect, tap } from '@pushrocks/tapbundle';
import * as smarttime from '../ts/index';
tap.test('should create a valid JavaScript Date from European TimeStamp', async () => {
const extendedDate = smarttime.ExtendedDate.fromEuropeanDate('10.10.2018');
console.log(extendedDate);
});
tap.start();

View File

@ -1,5 +1,5 @@
// tslint:disable-next-line:no-implicit-dependencies // tslint:disable-next-line:no-implicit-dependencies
import { expect, tap } from 'tapbundle'; import { expect, tap } from '@pushrocks/tapbundle';
import { Timer } from '../ts/index'; import { Timer } from '../ts/index';

View File

@ -1,5 +1,5 @@
// tslint:disable-next-line:no-implicit-dependencies // tslint:disable-next-line:no-implicit-dependencies
import { expect, tap } from 'tapbundle'; import { expect, tap } from '@pushrocks/tapbundle';
import * as smarttime from '../ts/index'; import * as smarttime from '../ts/index';
// Test TimeStamp class // Test TimeStamp class

View File

@ -1,8 +1,9 @@
import * as plugins from './smarttime.plugins'; import * as plugins from './smarttime.plugins';
export * from './smarttime.classes.date';
export * from './smarttime.classes.hrtmeasurement'; export * from './smarttime.classes.hrtmeasurement';
export * from './smarttime.classes.timer'; export * from './smarttime.classes.timer';
export * from './smarttime.classes.timestamp'; export * from './smarttime.classes.timestamp';
export * from './smarttime.units'; export * from './smarttime.units';
export { moment } from './smarttime.plugins'; export { luxon } from './smarttime.plugins';

View File

@ -1 +1,18 @@
import * as plugins from './smarttime.plugins'; import * as plugins from './smarttime.plugins';
export class ExtendedDate extends Date {
public static fromEuropeanDate(europeanDate: string) {
const dateArray = /(.*)\.(.*)\.(.*)/.exec(europeanDate);
const luxonDate = plugins.luxon.DateTime.utc(
parseFloat(dateArray[3]), // year
parseFloat(dateArray[2]), // month
parseFloat(dateArray[1]) // day
);
const unixMilli = luxonDate.toMillis();
return new ExtendedDate(unixMilli);
}
constructor(unixMilli: number) {
super(unixMilli);
}
}

View File

@ -39,7 +39,7 @@ export class Timer {
private currentTimeout: NodeJS.Timer; private currentTimeout: NodeJS.Timer;
// a deferred triggeted when Timer has completed // a deferred triggeted when Timer has completed
private completedDeferred = plugins.smartq.defer<void>(); private completedDeferred = plugins.smartpromise.defer<void>();
constructor(timeInMillisecondsArg: number) { constructor(timeInMillisecondsArg: number) {
this.timeInMilliseconds = timeInMillisecondsArg; this.timeInMilliseconds = timeInMillisecondsArg;

View File

@ -1,4 +1,9 @@
import * as moment from 'moment'; // @pushrocks scope
import * as smartq from 'smartq'; import * as smartpromise from '@pushrocks/smartpromise';
export { moment, smartq }; export { smartpromise };
// third parties
import * as luxon from 'luxon';
export { luxon };