Support » Plugins and Hacks » [Resolved] An empty 'End Date' is set as 'Start Date' and so always displays

[Resolved] An empty 'End Date' is set as 'Start Date' and so always displays

  • Nice plugin! But one small bug…

    If I set a ‘single day’ event (and so only fill in the Start Date) then the End Date is automatically and wrongly set to the same date.

    This means if you display an end date in a template – #@_{d/m/Y} – it will always display a date even if you intend this field to be empty – thus the ‘hint’ that says “If there is no end date, the value is not shown.” never applies.

    Currently the only workaround I’ve found to tidily show single-day and multi-day events together is to use the plugin’s conditional tags:
    #_{d M Y} [events_if tag="#ESC_{d M Y}" notvalue="#ESC@_{d M Y}"]- #@_{d M Y}[/events_if]

    While I’m writing this, the calendar picker is hard-coded as m/d/y which is very confusing if the rest of the site is working in d/m/y format. It does store and display the dates in the correct ‘user-chosen’ format elsewhere however. And final aside – the Event Time input is hard coded as AM/PM; a lot of the world uses a 24hr time format and a toggle to switch input format somewhere would be nice!

    I hate having to moan about what is otherwise the best plugin of its type IMHO!!!


Viewing 15 replies - 1 through 15 (of 23 total)
  • Plugin Author Franky


    The end date needs to be set, otherwise some SQL statements don’t work anymore. But I will remove the hint 🙂

    For the calendar and datepicker: since they are jquery, they are based on the locale of wordpress (not any setting). So if your language is English, the hour will be shown in AM/PM and the date will be shown m/d/y. Of course I’m open to suggestions for other date/time pickers …

    Thanks Franky – I think we can mark the End Date ‘bug’ as sorted! And the display workaround is now up here now for all to see and use 🙂

    But for the date, my server and locale is GB not US, WP is set correctly and the rest of the site is displaying as UK norms (ie 24Hr and d/M/Y). It is just these calendar and time pickers that are not co-operating.

    Does this jquery ignore WP settings and use something deeper in the server that I haven’t looked at yet?

    Plugin Author Franky


    The workaround has been documented as an example in the conditional tag documentation for quite some time 🙂

    For the locale, I use this:

    // Check if the locale is there and loads it
       $locale_code = substr ( get_locale (), 0, 2 );
       $show24Hours = 'true';
       // Setting 12 hours format for those countries using it
       if (preg_match ( "/en|sk|zh|us|uk/", $locale_code ))
          $show24Hours = 'false';
       $locale_file = EME_PLUGIN_URL. "/js/jquery-ui-datepicker/i18n/ui.datepicker-$locale_code.js";

    Does this mean that the UK uses 24-hour format? So then that’s easy to change, then I just needd to fix the datepicker (apparently the English locale file is not present, thus it takes the us version by default).

    Plugin Author Franky


    I fixed it for en-GB: 24 hour format and correct jquery format (I hope)

    Hi Franky

    Thanks for this v speedy fix! Your attitude really shines out!

    OK, I installed the dev version and I think there’s a typo in the fix:

    “Parse error: syntax error, unexpected ‘,’, expecting ‘)’ in /home/scarlett/public_html/wax/wp-content/plugins/events-made-easy/events-manager.php on line 212”

    I’ll take a look but you’ll probably want to fix 🙂

    Plugin Author Franky


    yeah, it was way too late last night 🙂
    Also: I think I have “en-US” in the files, while it should be “en_US”
    and the datepicker locale file ui.datepicker-en-GB.js should probably be ui.datepicker-en_GB.js as well.
    I think I need to redownload the latest standalone version for the datepicker again …


    Yep, just an unwanted extra comma before the new en-GB section on line 212.

    But the corrected version still makes no difference 🙁 I’ve still got the default US date/time pickers.

    Just double-checked and the page source confirms I am <html lang="en-GB">, I have all the en-GB mo files and my config file is also set to en-GB.

    Can I ask whether anybody who is running an international version has got anything other than mdy and 12Hr? Perhaps everyone else just tolerates it?

    Ack, hyphens, underscores…

    My site is now corrected to underscores (there’s so little diff between US and UK in WP I hadn’t noticed). I’d also corrected the hyphen to an underscore in your line 212 but as you say the datepicker js files might well throw everything so I think I’ll just wait for you to reconcile everything now!

    Plugin Author Franky


    This evening 🙂

    Plugin Author Franky


    Et voila, it should be ok in trunk now. In fact: wordpress uses underscores for it’s locales (even though examples are confusing), while jquery datepicker uses hyphens …

    Now it seems wordpress includes it’s own variant of jquery datepicker now, so I’ll try to switch to that one.

    Fantastic Franky!!!

    Works now like a charm – had to quickly reset the dates on the events already in the DB, but that was nothing.

    So thank you for sorting out one bug that wasn’t and one I didn’t realize was one 🙂 in only one day. Magnifique!

    Plugin Author Franky


    No prob!
    But what do you mean with “had to quickly reset the dates on the events already in the DB” ? Was the date wrongly entered in the DB?

    I never looked in the actual database, but when I looked in the admin after uninstalling old trunk and installing the new trunk, then the already entered events seemed initially to be in the unaltered (wrong) date format. So I just repicked them and they immediately resettled into the correct format. The times were already replaced by their 24Hr equivalents do I didn’t have to touch them and a new test event had no ‘problems’ either.

    As mentioned before, the front end never wavered (presumably because the actual dates are immediately serialized into the DB). Some form of cache? Certainly not a biggie!

    Plugin Author Franky


    In fact it’s a leftover hyphen ‘bug’ causing the wrong localised format to be chosen initially …
    Fixed here: http://plugins.trac.wordpress.org/changeset/688176/events-made-easy/trunk

    That line 212 again!!!

    I guess the only thing to take out now is that erroneous hint about empty dates 🙂

    Show Time! Thanks again!

Viewing 15 replies - 1 through 15 (of 23 total)
  • The topic ‘[Resolved] An empty 'End Date' is set as 'Start Date' and so always displays’ is closed to new replies.