Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display proper Hebrew year without ה #32

Closed
ghost opened this issue Jul 18, 2016 · 12 comments
Closed

Display proper Hebrew year without ה #32

ghost opened this issue Jul 18, 2016 · 12 comments

Comments

@ghost
Copy link

ghost commented Jul 18, 2016

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
Copy link

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

@ghost
Copy link
Author

ghost commented Jul 18, 2016

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

@ghost
Copy link
Author

ghost commented Jul 19, 2016

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 תשע"ו ?

@ghost
Copy link
Author

ghost commented Jul 22, 2016

Anyone?

Is this project abandoned?

@ghost ghost changed the title Option to display Hebrew date without diacritics Display proper Hebrew date without ה Jul 22, 2016
@ghost ghost changed the title Display proper Hebrew date without ה Display proper Hebrew yesr without ה Jul 22, 2016
@ghost ghost changed the title Display proper Hebrew yesr without ה Display proper Hebrew year without ה Jul 22, 2016
@Scimonster
Copy link
Contributor

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
.

@ghost
Copy link
Author

ghost commented Jul 22, 2016

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 תשע"ו ?

@ghost
Copy link
Author

ghost commented Jul 22, 2016

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
Copy link
Contributor

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
Copy link
Author

ghost commented Jul 22, 2016

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 ghost closed this as completed Jul 22, 2016
@ghost
Copy link
Author

ghost commented Jul 22, 2016

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

@Scimonster
Copy link
Contributor

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
Copy link
Author

ghost commented Jul 22, 2016

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

Fixed

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants