hebcal/hebcal-js

Display proper Hebrew year without ה

Opened this issue · 12 comments

Hi,
the following basic script will load the current date but with diacritics

<script type="text/javascript" charset="utf-8" src="http://hebcal.com/etc/hdate-he.js">var hebdate Hebcal.HDate(); console.log(hebdate);</script>

This displays: י״ב בְּתַמּוּז תשע״ו

Is there a way it can be called and displayed without the diacritics?

Thanks

@20Fourteen Are you seriously using new as a variable name? isn't it a reserved keyword?

Not in production, this is an alpha of a dev test

Okay, I got it.

I was using the wrong library.

It works now

`<script type="text/javascript" charset="utf-8" src="https://rawgit.com/hebcal/hebcal-js/master/client/hebcal.min.js"></script>

<script> var day = new Hebcal.HDate().toString('h'); document.write(day); </script>`

Result is: י"ג תמוז התשע"ו

Any way to remove the ה from the תשע"ו ?

Anyone?

Is this project abandoned?

You seem to have solved your issue, right?

On Jul 22, 2016 4:08 PM, "Glenn Parker" notifications@github.com wrote:

Anyone?

Is this project abandoned?


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#32 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ACshElN8aNMo32GElyLaH5PD05iItJKjks5qYMC0gaJpZM4JO-ts
.

No,

I was using the wrong library, but once sorted I'm facing this:

<script type="text/javascript" charset="utf-8" src="https://rawgit.com/hebcal/hebcal-js/master/client/hebcal.min.js"></script> <script> var day = new Hebcal.HDate().toString('h'); document.write(day); </script>

Result is: י"ג תמוז התשע"ו

Any way to remove the ה from the תשע"ו ?
Which argument

Okay, I got it.

I was using the wrong library.

It works now

<script type="text/javascript" charset="utf-8" src="https://rawgit.com/hebcal/hebcal-js/master/client/hebcal.min.js"></script> <script> var day = new Hebcal.HDate().toString('h'); document.write(day); </script>

Result is: י"ג תמוז התשע"ו

Any way to remove the ה from the תשע"ו ?

I'm not in charge of the website. It's possible those JS files are actually generated by server-side code using C.

As of right now there's no simple way to get the date without the ה. You could use a regex to remove it:

var day = new Hebcal.HDate().toString('h'); document.write(day.replace(' ה',' '))

This should be safe as no month name starts with ה.

I know about a regex, I wanted to do it cleanly and hoped there's an argument for it.

Perhaps getting the Gregorian date and converting day, month and year separately will yield the desired result, I wish the code would have something like HDateFull for ה'תשעו and HDatefor תשעו

Thanks

For anyone seeking the same, here is the code:
var day = new Hebcal.HDate().toString('h').replace(' \u05D4',' ');

That's a bit risky -- it'll mess up on the 5th or 25th of the month, and any year that ends in 5. You should use my regex which also includes a space before the letter.

Correct, I missed that, will edit (for the copy and paste people).

Fixed