jsmodern
Version:
An extension to existing JavaScript, influenced by other great languages such as Rust, Dart, Java, Golang, etc.
16 lines • 488 B
JavaScript
import { dateIsDate } from './is-date';
export function utilDateDifference(a, b) {
if (!dateIsDate(b))
throw new TypeError(`Cannot compare dates with non-date argument`);
const aTime = a.getTime();
const bTime = b.getTime();
return aTime - bTime;
}
export const difference = {
label: 'difference',
fn: function dateDifference(other) {
const ctx = this;
return utilDateDifference(ctx, other);
},
};
//# sourceMappingURL=difference.js.map