import dateFormat from 'dateformat';
const numberToDate = (timestamp) => dateFormat(new Date(timestamp), 'yyyy-mm-dd"T"HH:MM:ss.l');
const dateToNumber = (isoString) => Date.parse(isoString);
function roundMilliseconds(dateTimeString) {
    const date = new Date(dateTimeString);
    const roundedMilliseconds = Math.round(date.getMilliseconds() / 1000) * 1000;
    date.setMilliseconds(roundedMilliseconds);
    return dateFormat(date, 'yyyy-mm-dd"T"HH:MM:ss.l');
}
function getCurrentTimezoneOffset() {
    const now = new Date();
    return -now.getTimezoneOffset() / 60;
}
function numberToDateWithTimezone(timestamp, timezoneOffset) {
    const date = new Date(timestamp);
    const tzOffset = timezoneOffset || getCurrentTimezoneOffset();
    console.log('---tzOffset', tzOffset);
    const localTime = date.getTime();
    const localOffset = date.getTimezoneOffset() * 60000;
    const utc = localTime + localOffset;
    const timezoneDate = new Date(utc + 3600000 * tzOffset);
    return dateFormat(timezoneDate, 'yyyy-mm-dd HH:MM:ss');
}
export { numberToDate, dateToNumber, roundMilliseconds, numberToDateWithTimezone, };
//# sourceMappingURL=date.js.map