import ms from "ms" ; export type DateIntervalType = string ; export class DateInterval { public readonly ms : number ; constructor ( interval ) { this . ms = ms ( interval ) ; } getEndDate ( ) { return new Date ( this . getEndTimeMs ( ) ) ; } getEndTimeMs ( ) { return Date . now ( ) + this . ms ; } getEndTimeSeconds ( ) { return Math . ceil ( this . getEndTimeMs ( ) / 1000 ) ; } getSeconds ( ) { return Math . ceil ( this . ms / 1000 ) ; } static getDateEnd ( ms ) { return new DateInterval ( ms ) . getEndDate ( ) ; } }