pricehistory
Version:
Series data with technical indicators.
23 lines (22 loc) • 842 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
function setCandleDate(option, curr, candle) {
if (!option.datetime)
return;
const date = new Date(curr[option.datetime]);
candle.dateString = date.toLocaleString();
candle.dateObject = date;
if (option.date === true) {
candle.dateYear = date.getFullYear();
candle.dateQuarter = Math.floor((date.getMonth() + 3) / 3);
candle.dateMonth = date.getMonth() + 1;
candle.dateMonthName = date.toLocaleString("default", { month: "long" });
candle.dateDate = date.getUTCDate();
candle.dateWeekday = date.getUTCDay();
candle.dateWeekdayName = date.toLocaleDateString("default", {
weekday: "long",
timeZone: "UTC",
});
}
}
exports.default = setCandleDate;