Problems, need help? Have a tip or advice? Post it here.
10 posts Page 1 of 1
Just a quick question here...

So I'm integrating the Calendar with events into a new website and it's all working perfectly except for the k_timeline_position tag. Whenever I have it active, it shows the day marked on the calendar as the day before (right now it's Friday, April 7 and the calendar has April 6 marked). I've checked the server settings by outputting PHP values and they confirmed that the server is showing April 7th as the correct day, and even if I use cms:date or cms:date k_page_date it shows April 7th as the output.

Any feedback would help, I'm stumped.

Thanks!

Code below for this page:http://simivalley.webinkedesign.com/calendar/

Code: Select all
<?php
$previous = "javascript:history.go(-1)";
if(isset($_SERVER['HTTP_REFERER'])) {
    $previous = $_SERVER['HTTP_REFERER'];
}
$pageid = "calendar";
require_once ("inc/header.php"); ?>

<cms:template title='Calendar' clonable='1'>
    <cms:editable name='desc' label='Description' type='textarea' />
    <cms:editable name='location' label='Location' type='text' />

    <cms:editable name="start_time" label="Time From (24 Hrs)"
      opt_values=' Unspecified |
                  00:00 | 00:30 | 01:00 | 01:30 | 02:00 | 02:30 | 03:00 | 03:30 |
                  04:00 | 04:30 | 05:00 | 05:30 | 06:00 | 06:30 | 07:00 | 07:30 |
                  08:00 | 08:30 | 09:00 | 09:30 | 10:00 | 10:30 | 11:00 | 11:30 |
                  12:00 | 12:30 | 13:00 | 13:30 | 14:00 | 14:30 | 15:00 | 15:30 |
                  16:00 | 16:30 | 17:00 | 17:30 | 18:00 | 18:30 | 19:00 | 19:30 |
                  20:00 | 20:30 | 21:00 | 21:30 | 22:00 | 22:30 | 23:00 | 23:30 |'
      type='dropdown'
    />

    <cms:editable name="end_time" label="Time Until (24 Hrs)"
      opt_values=' Unspecified |
                  00:00 | 00:30 | 01:00 | 01:30 | 02:00 | 02:30 | 03:00 | 03:30 |
                  04:00 | 04:30 | 05:00 | 05:30 | 06:00 | 06:30 | 07:00 | 07:30 |
                  08:00 | 08:30 | 09:00 | 09:30 | 10:00 | 10:30 | 11:00 | 11:30 |
                  12:00 | 12:30 | 13:00 | 13:30 | 14:00 | 14:30 | 15:00 | 15:30 |
                  16:00 | 16:30 | 17:00 | 17:30 | 18:00 | 18:30 | 19:00 | 19:30 |
                  20:00 | 20:30 | 21:00 | 21:30 | 22:00 | 22:30 | 23:00 | 23:30 |'
      type='dropdown'
    />

    <cms:editable name='end_date'
        label='Event End Date (if multi-days event)'
        desc='Enter date in yyyy-mm-dd format e.g. 2010-12-31'
        type='text'
        validator='regex=/(?:19|20)\d\d-(?:0[1-9]|1[012])-(?:0[1-9]|[12][0-9]|3[01])/'
        separator='#'
        validator_msg='regex=Incorrect date format'
    />

</cms:template>

<div class="row page-info">
   <div class="container">
        <div class="col s12 sub-content">
            <cms:if k_is_page >
        <!-- Page View -->
        <b>Event:</b> <cms:show k_page_title /><br>
        <b>Description:</b> <cms:show desc /><br>
        <b>Location:</b> <cms:show location /><br>
        <b>Date:</b> <cms:date k_page_date format='F j, Y' /><br>
        <cms:if start_time!='Unspecified' >
            <b>From:</b> <cms:show start_time /><br>
        </cms:if>
        <cms:if "<cms:not_empty end_date />" >
            <b>End Date:</b> <cms:date end_date format='F j, Y' /><br>
        </cms:if>
        <cms:if end_time!='Unspecified' >
            <b>Till:</b> <cms:show end_time /><br>
        </cms:if>
            <a href="<?= $previous ?>">Back to Calendar</a>   

    <cms:else />
        <!-- List view -->
        <cms:calendar date="<cms:gpc 'cal' />" masterpage=k_template_name show_future_entries='1' >
            <table class="calendar_big">
                <tr>
                    <th><a href="<cms:concat k_page_link '?cal=' k_prev_calendar_date />"> << </a></th>
                    <th colspan="5"><cms:date k_calendar_date format='F Y' /></th>
                    <th><a href="<cms:concat k_page_link '?cal=' k_next_calendar_date />"> >> </a></th>
                </tr>
                <tr>
                    <cms:repeat count='7'>
                    <td class="months_heading"><cms:zebra 'Su' 'M' 'T' 'W' 'Th' 'F' 'S'/></td>
                    </cms:repeat>
                </tr>

                <cms:weeks>
                    <tr>
                    <cms:days pad_with_zeroes='0' >
                        <cms:if k_timeline_position='present'>
                            <cms:set tdclass='today' />
                            <cms:date />
                        <cms:date k_page_date />
                        <cms:else />
                            <cms:set tdclass='' />
                        </cms:if>

                        <cms:if k_position='current_month' >
                            <cms:if k_count_entries >
                                <td class='entries <cms:show tdclass />' align='center'>
                                    <cms:show k_day />
                                    <ul>
                                    <cms:entries limit='2' skip_custom_fields='1'>
                                        <li>
                                            <a href="<cms:show k_page_link />"><cms:show k_page_title /></a>
                                        </li>
                                    </cms:entries>
                                    </ul>
                                </td>
                            <cms:else />
                                <td class='<cms:show tdclass />' ><cms:show k_day /></td>
                            </cms:if>
                        <cms:else />
                            <td class='other_month'><cms:show k_day /></td>
                        </cms:if>
                    </cms:days>
                    </tr>
                </cms:weeks>
            </table>
        </cms:calendar>
    </cms:if>
        </div>
    </div>
</div>


<div class="row sub-cta">
    <div class="container">
        <div class="col s12">
            <hr class="dot">
            <h3>Is Simi Valley Adventist School the right choice for your child? Find out now!</h3>
            <a href="#" class="btn">Request Info</a>
            <hr class="dot">
        </div>
    </div>
</div>
<?php require_once ("inc/footer.php"); ?>
So as of 5am it was showing the 6th as active, but now at 12:15pm it's showing the 7th as active (Los Angeles, CA time). I'm not sure when it changed but I'll keep an eye on it tonight to see what happens.

Still not sure what the deal is.
Hi,

Have you made sure the timezone set in Couch's config (as shown below) matches that of your location?
// 2.
// Your Time Zone
// Example values (note how :15, :30, :45 will be entered as .25, .5 and .75 respectively):
// +12.75 New Zealand (UTC+12:45)
// +8.75 Australia (UTC+08:45)
// +5.5 India (UTC+05:30)
// +1 Germany (UTC+01:00)
// 0 United Kingdom (UTC±0)
// -2 Brazil (UTC-02:00)
// -4.5 Venezuela (UTC-04:30)
// -6 United States (Central Time) (UTC-06:00)
// -8 United States (Pacific Time) (UTC-08:00)
define( 'K_GMT_OFFSET', +5.5 );

Please check and let me know.
Hi KK,

Yes, this is how my config file is set

Code: Select all
 // 2.
    // Your Time Zone
    // Example values (note how :15, :30, :45 will be entered as .25, .5 and .75 respectively):
    // +12.75 New Zealand (UTC+12:45)
    // +8.75  Australia (UTC+08:45)
    // +5.5   India (UTC+05:30)
    // +1     Germany (UTC+01:00)
    // 0      United Kingdom (UTC±0)
    // -2     Brazil (UTC-02:00)
    // -4.5   Venezuela (UTC-04:30)
    // -6     United States (Central Time) (UTC-06:00)
    // -8     United States (Pacific Time) (UTC-08:00)
    define( 'K_GMT_OFFSET', -8 );


Thanks!
In that case, I'd like to study the problem first-hand.
If it is ok with you, please PM me the FTP + Couch creds for your site.

Thanks.
Hi @kk,

I PM'd you the creds, let me know if you have any other questions regarding my setup.

Thanks!
Apologies for the delay in attending to your PM, @webinke

Thanks for the creds. I had a look at the site and have made some changes.
Could you please keep an eye on the calendar for some time and let me know if the issue is now fixed?

Thanks.
Hi @kk,

I've been watching the calendar for a couple days and there has been no change. The day is still changing somewhere between 2-5am.

Thanks for your help on this.

It's not a huge problem, as I doubt most people will be looking at the calendar at that time in the morning, it just bugs me that I can't figure it out.
Hi,

I'd be pretty unexpected if the code change I made did not correct the calculation, so I revisited your site.
What I found is that the current time being reported (simply used <cms:date format='Y-m-d H:i:s' /> in the template) was one hour behind the actual time in Los Angeles at that moment.

So, the day is getting switched an hour after mid-night your place.

As to why this is happening, I think you forgot the DST in effect currently which makes Los Angeles -7 GMT and not -8 GMT as you have configured. Right? :)

For automatically taking GST into consideration, please see viewtopic.php?f=8&t=8098

Hope it helps.
Hi @kk,

Of course it was the stupid easy thing. I completely forgot about taking DST into account. Once I modified the code like in the example it switched right over to the new day at 12am.

Once again, thanks for all the help!
10 posts Page 1 of 1