Events+ displays date/time differently when showing a different time zone

I currently have my events date/time format displayed like "June 29, 2016 1:00 pm" and honestly, I can't figure out how or where I changed it.

I thought it was all fine, until today when I turned on the Time Zones add on. I had a colleague in another time zone confirm it was working, and when he sent me a screenshot I noticed that the date/time is back to default and it is different than what I see in my timezone.

His screenshot is below.

I want it to read the way it does for my local timezone, with the date only once, and the "from" and "to" being just the times (not the extra date after "to" as we see in the screenshot).

June 29, 2016 from 12:00 pm to 1:00 pm

I'm sure the way to change it must be similar to how I changed the layout that I am seeing for my own timezone....but I hope someone can point me in the right direction, because none of my templates seem to be responsible for making this formatting change.

Also, please tell me exactly what file would be used to make the change for "other" timezones.

My site is open for support staff, in case you need to poke around.

Thanks in advance :slight_smile:

  • Rupok

    Hi kalico, hope you had a wonderful day.

    It's a bit weird. I went to this page: http://june.nrocnetwork.org/events/2016/06/nroc-info-sessions-benefits-of-nroc-membership/ but I can see the date format as you are expecting. Please check the attached screenshot for reference.

    I'm not sure but his browser might be doing this. Can you ask him to try from another browser or from another computer? Please let us know the result.

    I'm looking forward to hear from you and resolve this issue as soon as possible.

    Have a nice day. Cheers!
    Rupok

  • kalico

    Ok, one last point here....

    In my original post I said

    I want it to read the way it does for my local timezone, with the date only once, and the "from" and "to" being just the times (not the extra date after "to" as we see in the screenshot).

    June 29, 2016 from 12:00 pm to 1:00 pm

    But you'll notice that in my screenshot from Chrome (which is my default browser, and where I saw this date layout in the first place), the DATE/TIME FORMAT HAS CHANGED and mirrors the one I do not want, which is now ONLY working on Safari!

    Since I haven't made any changes that I know of, I really need to know where these are being generated from. I *know* that I worked on this date format a long time ago, because I changed it to look like Safari does now. That is my goal.

    I just can't figure out how it broke between yesterday and today.

    But I can perhaps provide another clue (or something to add confusion....)

    Just yesterday, in another ticket, I requested help getting the words "Takes place on" and "Took place on" to go away. I was given some code by Rupok which worked like a charm. But today, the effects completely reversed and I now have those words displaying again.

    So *something* has happened that is nullifying my changes. Somehow. But since I don't even know where these changes are coming from in the first place, I'm really stumped on how to troubleshoot it.

    I sure hope that you wonderful people can help me figure this out. :slight_smile: Thanks in advance.

  • Ash

    Ohh, actually, let's try by replacing by Rupok's code in other thread with the following:

    <?php
    add_action( 'wp_footer', 'hide_location_text' );
    function hide_location_text() {
        ?>
        <script type="text/javascript">
            jQuery(function($){
                $('.wpmudevevents-date').each(function() {
                    $(this).text($(this).text().replace(/Takes place on/g, ""));
                    $(this).text($(this).text().replace(/Took place on/g, "")); ;
                });
            });
        </script>
        <?php
    }

    Hope it helps :slight_smile: Please feel free to ask more question if you have any.

    Cheers
    Ash

  • kalico

    Hey Ash Thanks for that....it does work to do what Rupok's code did.

    However, I'm still getting the formatting of the date that I don't like.

    I have:

    6/27/2016 from 1:00:00 PM to 6/27/2016 2:00:00 PM

    ...in Chrome and Firefox.

    What I want is:

    June 27, 2016 from 1:00 pm to 2:00 pm

    ...which is what I see in Safari. (And used to see in Chrome....)

    (BTW I don't really care if it's AM/PM or am/pm.)

    Any idea if this is something I can fix?

    I know I had it working how I liked it -- until a couple days ago. Maybe all this timezone stuff is a red herring, and it's actually different browsers coupled with something else I did (maybe this code?).

    Thanks!!

  • Ash

    Hi kalico

    I have found the issue, that's kind of bug. I have reported to the developer.

    Meantime, please go to /wp-content/plugins/events-and-bookings/js/eab-events-local_timezones.js remove line no 34 to 41:

    $me
    				.text((
    					$me.is(".eab-date_format-time")
    						? date.toLocaleTimeString(locale).split( ' GMT' )[0]
    						: date.toLocaleDateString(locale).split( ' GMT' )[0]
    				))
    				.attr("title", old)
    			;

    and paste the following:

    if( $me.is(".eab-date_format-time") && old != '' )
                            {
                                $me.text( date.toLocaleTimeString(locale).split( ' GMT' )[0] );
                            }
                            else if( $me.hasClass(".eab-date_format-date") && old != '' )
                            {
                                $me.text( date.toLocaleDateString(locale).split( ' GMT' )[0] );
                            }

    Please note that, this changes will be lost in next update. So it's worth to note down this changes somewhere and apply again after your updates. I will try to make sure to apply this change in next update :slight_smile:

    Hope it helps :slight_smile: Please feel free to ask more question if you have any.

    Cheers
    Ash

  • kalico

    Hi Ash I have added that code, and it didn't quite work. I need to state here that I am reasonably certain that something ELSE is causing all of this. Here's why:

    - Earlier in this thread, I mentioned that something is changing the date/time, and it's not something I am aware of changing.

    - Rupok's code worked fine, and the next day it was clobbered by "something".

    - Your code to replace Rupok's worked fine, and the next day it was clobbered again, although I did not knowingly change anything that would relate to Events or CSS. To explain this further.....

    Today, BEFORE I swapped in your code for the timezone problem, I discovered that the pages displaying Events+ content have completely reverted to their default formatting, ignoring all changes I have made in custom CSS.

    When I did some research with dev tools, here is what I see:

    That front.css is not my custom CSS file....it's coming from Events+. I've taken pains to override that with custom CSS and yet "somehow" it's ignoring my custom settings, when it never did that before.

    I fully realize this might be something I've done, unrelated to Events+. But I just can't figure out what it would be, since I'm not doing any work on these pages, other than what you've instructed me to do in response to these issues I've posted.

    In the next screenshot, you can see that front.css is being processed after custom.css, and yet it's styles are taking precedence.

    I should add that this problem is not happening anywhere else, in any other pages of my site. Only in E+ pages.

    Any ideas would be gratefully received. :slight_smile:

  • Ash

    Okay, I have made some tweak and fixed something. This is how it currently looks like:

    There are some problem in your custom css. I have moved the ".wpmudevevents-date" related custom css at the top and it's working now. So, in your custom css section, there is a part, somewhere, you have wrong syntax/broken css, so the followed css are not working. You have to find out that wrong css, fix/remove it and other custom css will start overriding again.

    In addition, I can see the local dates are working fine in the format you wanted :slight_smile:

    Hope it helps :slight_smile: Please feel free to ask more question if you have any.

    Cheers
    Ash

  • Ash

    Hello kalico

    Greta, we are closer now :slight_smile:

    Please replace my above code with the following:

    if( $me.is(".eab-date_format-time") && old != '' )
                            {
                                var modified_time = date.toLocaleTimeString(locale).split( ' GMT' )[0];
                                var splitted_time = modified_time.split( ':' );
                                var count = splitted_time.length - 1;
                                if( count > 1 )
                                {
                                    var seconds = splitted_time[2].split( ' ' )[1];
                                    modified_time = splitted_time[0] + ':' + splitted_time[1] + ' ' + seconds;
                                }
                                $me.text( modified_time );
                            }
                            else if( $me.hasClass(".eab-date_format-date") && old != '' )
                            {
                                var modified_date = date.toLocaleDateString(locale).split( ' GMT' )[0];
                                $me.text( modified_date );
                            }

    Hope it helps :slight_smile: Please feel free to ask more question if you have any.

    Cheers
    Ash

  • kalico

    Hi Ash

    Yes, that did it!! All the browsers are responding the same now. :slight_smile: Thank you so much, we are getting to the bottom of all this.

    I have just one more question about this....is it possible that this same modification could be made in a template class for E+? The reason I'm asking is that I'm still trying to figure out where I originally made this modification myself. I don't want to leave conflicting code or sloppy code somewhere else in my files.

    Also, just to confirm....you said this is expected to be in the next update of E+?

    Hopefully those will be easy answers compared to the rest of this thread. :slight_smile:

    And BTW, just wanted to tell you I am still wearing a dunce cap. After 20+ years of coding for the web, I am quite ashamed of myself for not considering the possibility of a missing semi-colon breaking my CSS. <:\ Thank you again for finding it!

  • Kasia Swiderska

    Hello kalico,

    Also, just to confirm....you said this is expected to be in the next update of E+?

    Let me check this with Ash, to be sure that there is task for this change created so it will be added in next release. This way when you update plugin it will have this change but none of the modification you could made yourself in the plugin code.

    You might consider taking a backup of the plugin in its current form, check threads where there were fixes and changes made by support staff (that were fixing issues) and then install clear version and apply them again - this way you will have clean plugin code with only patches that are working so you wont be worried about conflicting code.
    However you should wait until rest of the support staff will finish with your site - if I recall correctly Ivan is working there.

    kind regards,
    Kasia

  • kalico

    Hi Ash :slight_smile: Thanks for that! No worries...this one is actually a very minor thing compared to the other bugs I've reported. I can deal with some minor formatting issues especially when I've got a much-appreciated fix in hand. I am much more anxious to see the category/ies working right in shortcodes, and resolve that network thing (which Ivan is going to look at as soon as my IT guy can get him access to my site, hopefully today...) :wink:

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.