import { d1900, MilliSecondsInDay } from "./constants";
import isdate from "./isdate";
import { ERRORTYPES as error } from "./error";
Copyright 2015-2021 JC Fisher
import { d1900, MilliSecondsInDay } from "./constants";
import isdate from "./isdate";
import { ERRORTYPES as error } from "./error";
SERIAL convert a date object into a serial number.
export default function serial(date) {
if (!isdate(date)) {
return error.na;
}
var diff = Math.ceil((date - d1900) / MilliSecondsInDay);
return diff + (diff > 59 ? 2 : 1);
}