narou
Version:
Narou API Wrapper
25 lines (24 loc) • 701 B
JavaScript
// src/util/date.ts
function parseDate(dateStr) {
const year = parseInt(dateStr.substring(0, 4), 10);
const month = parseInt(dateStr.substring(4, 6), 10) - 1;
const day = parseInt(dateStr.substring(6, 8), 10);
return new Date(year, month, day, 0, 0, 0, 0);
}
function formatDate(date) {
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, "0");
const day = String(date.getDate()).padStart(2, "0");
return `${year}${month}${day}`;
}
function addDays(date, days) {
const result = new Date(date);
result.setDate(result.getDate() + days);
return result;
}
export {
parseDate,
formatDate,
addDays
};
//# sourceMappingURL=chunk-RNHRR56W.js.map