hebcal / hebcal-js

⛔️ DEPRECATED - a perpetual Jewish Calendar (JavaScript)
GNU General Public License v3.0
123 stars 40 forks source link

Display proper Hebrew year without ה #32

Closed ghost closed 8 years ago

ghost commented 8 years ago

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

efroim102 commented 8 years ago

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

ghost commented 8 years ago

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

ghost commented 8 years ago

Okay, I got it.

I was using the wrong library.

It works now

`

` Result is: **י"ג תמוז התשע"ו** Any way to remove the **ה** from the תשע"ו ?
ghost commented 8 years ago

Anyone?

Is this project abandoned?

Scimonster commented 8 years ago

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 https://github.com/hebcal/hebcal-js/issues/32#issuecomment-234538965, or mute the thread https://github.com/notifications/unsubscribe-auth/ACshElN8aNMo32GElyLaH5PD05iItJKjks5qYMC0gaJpZM4JO-ts .

ghost commented 8 years ago

No,

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

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

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

Okay, I got it.

I was using the wrong library.

It works now

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

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

ghost commented 8 years ago

How is this achieved here? https://gist.github.com/mjradwin/08bcc39a1d2b3de7491f#file-hebdate-he-html

By the way there is a problem with the HTTPS on this page https://www.hebcal.com/home/40/displaying-todays-hebrew-date-on-your-website

Scimonster commented 8 years ago

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 ה.

ghost commented 8 years ago

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

ghost commented 8 years ago

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

Scimonster commented 8 years ago

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.

ghost commented 8 years ago

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

Fixed