@nomiclabs/buidler
Version:
Buidler is an extensible developer tool that helps smart contract developers increase productivity by reliably bringing together the tools they want.
12 lines (9 loc) • 314 B
text/typescript
export function parseDateString(str: string): Date {
return new Date(str);
}
export function dateToTimestampSeconds(date: Date): number {
return Math.floor(date.valueOf() / 1000);
}
export function getDifferenceInSeconds(a: Date, b: Date): number {
return Math.floor((a.valueOf() - b.valueOf()) / 1000);
}