Skip to content

Instantly share code, notes, and snippets.

@ayal
Last active February 2, 2022 19:46
Show Gist options
  • Save ayal/bd9d2168874b9ff4e251ff4d98f94d0e to your computer and use it in GitHub Desktop.
Save ayal/bd9d2168874b9ff4e251ff4d98f94d0e to your computer and use it in GitHub Desktop.
hebrew date match
import { HDate } from '@hebcal/core';
const month = 1; // feb, zero based (so 0=jan, 1=feb etc..)
const day = 2;
const time = 13;
const year = 1984;
for (let i = 0; i < 120; i++) {
const loazi_date = new Date(year+i, month, day, time) // 02/02/198X 13:00
const hebrew_date = new HDate(loazi_date);
if (hebrew_date.render().indexOf(`29th of Sh'vat`) !== -1) {
console.log('date match!', loazi_date.toDateString());
}
}
import { HDate } from '@hebcal/core';
const month = 6;
const day = 20;
const time = 13;
const year = 1978;
const loazi_date = new Date(year, month, day, time)
const hebrew_date = new HDate(loazi_date);
console.log('original date:', hebrew_date.render());
for (let i = 0; i < 120; i++) {
const loazi_date = new Date(year+i, month, day, time)
const hebrew_date = new HDate(loazi_date);
if (hebrew_date.render().indexOf(`15th of Tamuz`) !== -1) {
console.log(`date match after ${i} years`, loazi_date.toDateString());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment