Hebrew Dates v1.0.3


Based on feedback from KosherJava (on the v1.0.2. release announcement), I’ve enhanced the currentHebrewDate() API in the Hebrew Dates plugin. It now accepts parameters to control how the date is printed.

Usage

HebrewDate provides an API, hebrewDateCurrent($dateFormat,$location) that can be used to display the current Hebrew Date in your favorite theme. If called with no parameters (or an illegal combination of parameters), it displays the current Hebrew Date according to the Character Set configuration above. By setting $dateFormat to a valid PHP date format, and $location to either "before" or "after" (including the quotation marks), it will display the secular day as well ($location controls the placement of the Hebrew Date).

Alternatively, $dateFormat can be set to the special value of "date_format", in which case it will use the default wordpress formatting.

Finally, $dateFormat can be set to the special value of "default". In this case, the $location parameter is ignored, and the function produces the same value that the_time() produces within The Loop.

Samples

In the legal cases, it functions according to the rules above. In the illegal cases, it returns the default value (same as if it receives no arguments)

Legal: hebrewDateCurrent():
Legal: hebrewDateCurrent(“r”,”before”):
Legal: hebrewDateCurrent(“r”,”after”):
Illegal: hebrewDateCurrent(“r”):
Illegal: hebrewDateCurrent(“”,”after”):
Illegal: hebrewDateCurrent(“date_format”):
Legal: hebrewDateCurrent(“date_format”,”after”):
Legal: hebrewDateCurrent(“F y H:m”,”after”):
Legal: hebrewDateCurrent(“default”):

The new version is 1.0.3, and is available at the Hebrew Dates release page.


22 responses to “Hebrew Dates v1.0.3”

  1. Mike,

    I’ve just started using your version of Hebrew Date. And it works like a charm, but I have a question. I’ve chosen to display the Gregorian Date and the Hebrew Date. But I also want to use your hebrewDateCurrent-function. However, I can’t get it to just display the hebrew date (i’m using my own plugin for the normal spelling). Is there anyway to make it do that?

    Lehitra’ot,

    Jacob

  2. Mike,

    My mistake. Without arguments, that function displays the same as my own. But what I want is it to display the current date in full hebrew. Like if you set the options for that plugin to ‘Hebrew months’ and without the use of Arabic numbers.

    The problem is that I want that kinda display only when using the hebrewDateCurrent() and not under the titles of posts. So, I cannot use the options for that.

    I hope this explanation is somewhat clearer…

  3. Gotcha. In other words, you want to have a separate set of options for the formatted HebrewDate from hebrewDateCurrent (distinct from those used by the wrapper for post & comment dates).

    Shouldn’t be a big deal, but I’m kinda busy at the moment. I’m also working on rewriting much of the code; if you don’t see a post from me by, say, Tuesday (post Purim), feel free to bug me again ๐Ÿ˜‰

  4. Thanks Mike! A separate set of options would be the preferred thing to have, yes. I’ll wait for the new code. As for updating code, I’ve decided that my plugin could also use a make-over, so, besided the small fix I’ve added today, I’m going to expand it a little…

    Lehitra’ot

  5. Glad you remembered, and no, I didn’t forget. ๐Ÿ™‚

    That said, it’s going to be a (hopefully short) while, though. I have one or two personal things going on these days that are taking up most of my time, and I’m a little reluctant to add too much more new code before cleaning up some of the cruft that’s there now.

  6. Mike,
    You might want to have a look at the enhancements I recently made to the Jewish date code in PhpGedView. Have a look at http://svn.sourceforge.net/viewvc/phpgedview/trunk/phpGedView/includes/functions_date_hebrew.php?sortby=date&view=log
    The main change was to use a geresh and gershayim instead of single and double quotes. There are many issues that can come up when using quotes within code, and this solves some of them. Also removed was the span wrapper. The geresh and gershayim use also resolves some directionality issues.

  7. Hi
    I’m using wordpress version 2.7 and I want to use this perfect plug but I got this strange problem
    When the plug is starting I’ve got the same date in all of my posts.
    The sate I’ve got is: ร—โ€บ”ร—โ€˜ ร—หœร—โ€˜ร—ยช ร—โ€’ ร—ยชร—ยฉ”ร—ล“

    I do not know how to fix it.
    please help me

    Thank you .

    Dolev

  8. I’m running 2.7, and it appears to be working here.

    22 Teves 5730 corresponds to Jan 1st 1970; aka, unix time 0. For some reason, it’s not picking up the proper dates.

    Did you change your date format to something non-standard? Can you try changing it back to the default format, and seeing if it helps?

  9. Hi Mike!

    I just added your great plugin to the homepage of our youth center.
    I would like to know, how we can add a fullstop after the numbers for the day?

    So now it looks like this: “24 Tischrej 5776”,
    but it should look like “24. Tischrej 5776”.

    Where in the code can I add this fullstop?!

    Thank you in advance about a timely response!

Leave a Reply

Your email address will not be published. Required fields are marked *