BREAKING CHANGE(deps): remove moment and use luxon
This commit is contained in:
@ -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';
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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 };
|
||||
|
Reference in New Issue
Block a user