Files
echo-nexus/node_modules/react-day-picker/dist/esm/hebrew/lib/setMonth.js
T

10 lines
461 B
JavaScript

import { toGregorianDate, toHebrewDate } from "../utils/dateConversion.js";
import { monthIndexToHebrewDate, monthsSinceEpoch } from "../utils/serial.js";
export function setMonth(date, month) {
const hebrew = toHebrewDate(date);
const baseIndex = monthsSinceEpoch({ year: hebrew.year, monthIndex: 0 });
const targetIndex = baseIndex + month;
const target = monthIndexToHebrewDate(targetIndex, hebrew.day);
return toGregorianDate(target);
}