BREAKING CHANGE(deps): remove moment and use luxon

This commit is contained in:
2018-10-17 01:42:36 +02:00
parent 539bbc1568
commit ed1f79caa4
10 changed files with 555 additions and 263 deletions

View File

@ -1,8 +1,9 @@
import * as plugins from './smarttime.plugins';
export * from './smarttime.classes.date';
export * from './smarttime.classes.hrtmeasurement';
export * from './smarttime.classes.timer';
export * from './smarttime.classes.timestamp';
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';
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

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