Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Updated to work with Vanilla 2.3

This discussion is related to the Event Calendar addon.


  • @TheStrangeAttractor said:
    where would I put the code in for this input field? and what code would you put exactly if you had to?

    That input field is luckily not necessary anymore, I was basically proposing a shitty hack to accomplish something that's already done.

    Could you try to add these lines of code on line 230 of class.eventcalendar.plugin.php to see if it fixes your problem?
    Theoretically it should, but you know...

    If instead of showing the correct date it's now two days wrong, then you should replace "-$userOffset3600+date('Z');" with "+$userOffset3600-date('Z');"

    (So that code block I proposed should come after this blurp:)

    @R_J said:
    @Caylus said:

    Bad at explaining the exact problem. @R_J you get what I'm trying to say

    Yes, I do and it sounds reasonable. I'm not sure though if I can think of any way to solve that problem.

    @Caylus said:

    is it better if I code what I think will fix the problem so you can reverse engineer what the problem was?

    If you have a solution in mind, feel free to create a pull request on the GitHub repo.

    Okay, I need to think about that: The users hour offset and timezone should be enclosed in every controller. So if I accept a date from the user, it should substract/add the users hour offset before saving the date, correct? Let me have a try...

    Thanks R_J, didn't know Vanilla already kept track of the user time offset! (although in retrospect I should have known, otherwise GDN_translate couldn't do what it did).

    Created a pull request which should synchronize the submitted time with server time.

  • R_JR_J Ex-Fanboy Munich Admin

    Thanks for the contribution! Let me test first if that really corrects the time zone or makes it even worse ;-)

    There are a few things which either you could change before or I will change after I accepted that request:
    a) Formatting for brackets and space
    b) I would position that transformation after the validations and add a

    if ($sender->Validation->validationresults()) {

    If the field is empty or no valid date, there is no need to proceed
    c) Guests time zones are not fixed. Using method hourOffset() instead of property HourOffset should be enought:
    d) Instead of assigning values to variables, I would at least try to write that as "one command"

  • Probably more efficient if you fix the final version instead of moi, since you're more familiar with how you want it :P

    Coding standards are not my forte ;)

  • R_JR_J Ex-Fanboy Munich Admin

    After looking at it again, I think that this is a dead end. Column format is date and not datetime.

    There is no intention for providing a time, too, for the moment. If the time would be of any relevance, that code should do:

            // Make date independent from user offset.
            if ($sender->Validation->results()) {
            // $hourOffset = $session->hourOffset()
            $args['FormPostValues']['EventCalendarDate'] = Gdn_Format::toDateTime(
                strtotime($args['FormPostValues']['EventCalendarDate']) -
                Gdn::session()->User->HourOffset * 3600

    But if use datetime and I create an event on the 1st of January ("Happy New Year!") here in UTC+2 timezone, it will be saved as 2017-12-31 22:00. Users from UTC+0 would see that targeted for the 31st of December (or the other way around, I find that very confusing).

    For the sake of simplicity, time zones should be left outside. I think the error is using a format function which takes the users hour offset into consideration. I see if I can change that.

  • I've added the code as is on line 230 and I'm getting a fatal error. Does anyone have an updated class.eventcalendar.plugin.php that I can just copy and paste. My coding isn't really up to par, at least enough to take simple advice and put it to use

  • R_JR_J Ex-Fanboy Munich Admin

    I'm working on it, just give me some time.

  • Any luck with anything? I'm going to try to get it running with the advice you have today, but will probably throw in the towel if I can't get it quick enough.

  • I grabbed the code from and now have even bigger issues. Not only is the date still incorrect (one day early) on the discussion page, but the calendar and settings pages won't even show up. The below screenshot is what I see when I click 'event calendar' on the menu, or if I try to access the event calendar settings from the dashboard.

  • Is there any reason for the extreme hurry?

    I realize it's frustrating the time you spend on getting it working but it not working, but that's mostly due to us not having figured out the best solution yet and you therefore trying partial untested solutions before we've tested them and made sure they're bug-free.

    I personally recommend, if that is an option for you, to just return in a week or so. By then R_J has (probably) found time to figure out how he wants to fix the problem (but keep in mind he's a volunteer!), and has had time to test it.

  • Oh sheesh, I didn't mean to rush you guys. I figure beggars can't be choosers with all this, and by all means take as much time as y'all need, I was surprised to even get a reply on this old thread tbh. Thanks for the help.

  • R_JR_J Ex-Fanboy Munich Admin

    The problem with the github version is most probably due to the way downloads from github are named. Can it be that you have unzipped the file from GitHub to EventCalendar-master?

    Based on Caylus work I'm quite sure what I need to change. You can expect to see another version soon and it would by great if you could test if that solves your time zone problem.

  • CaylusCaylus ✭✭
    edited August 2017

    StrangeAttractor, hope I didn't come across as annoyed or anything!

    I just know how frustrating it is to have a solution that seems -just- out of reach XD The suggestion of a week was therefore more intended as a suggestion for self-protection for you, because I hate people wasting their time. (Although personally I wouldn't be able to follow my own advice and probably also just spend that week tinkering with partial solutions in the hope one works XD)

  • R_JR_J Ex-Fanboy Munich Admin

    @TheStrangeAttractor please try the current version from GitHub. Be sure that the folder will be named EventCalendar and not EventCalendar-master.

    If you give me a positive feedback that the time zone problem is fixed, I will upload that version here.

    @Caylus thanks for speaking out what I've just thought. It helped clarifying!

  • @R_J said:
    @TheStrangeAttractor please try the current version from GitHub. Be sure that the folder will be named EventCalendar and not EventCalendar-master.

    If you give me a positive feedback that the time zone problem is fixed, I will upload that version here.

    @Caylus thanks for speaking out what I've just thought. It helped clarifying!

    Nailed it! The event calendar from the is working on my forum like a charm! I just had to rename the file to "EventCalendar" from "EventCalendar-Master". Thanks for all your work R_J and Caylus, let me know how I can return the favor.

  • R_JR_J Ex-Fanboy Munich Admin

    Thanks for the feedback! I've uploaded the github version to the addons section now.

    Giving feedback is a great way of giving back, if you cannot donate code.

Sign In or Register to comment.