ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Spooky Localization behavior

January 13, 2012 6:50pm

Subscribe [1]
  • #1 / Jan 13, 2012 6:50pm

    Hi y’all,

    I’m having a strange time after having migrated a handful of entries from a WP site. Now that they are in EE, I’m noticing that these two plaforms have a very different sense of how to store date/time information.

    This wouldn’t matter except that these are being marked on a calendar and listed as entries on the same page, sometimes appearing as two different dates.

    One example: the exp:channel:calendar shows November 9 as its publication date, yet as a channel:entry, it displays as “Published on November 10” on the same page.

    It’s publication date in the CP is: 2011-11-10 02:28 AM. The sites localization settings are Mountain Standard Time with an offset of 200 (Experimental settings, which seemed to have killed the bulk of these date bugs until now.)

    I know the client had been posting from Pacific Time for the history of the content.

    I’m realizing that I can’t just hack at this anymore and need to know more about how these settings work with the modules in order to proceed.

    It looks like channel:calendar and channel:entries apply inconsistent configurations for output. Is this right? is there a way to bulk-change problematic times to 12:00PM on their given day? I don’t know how to begin to fix it.

    Thanks for your ongoing support and in advance for helping me sleuth out this weirdness.

  • #2 / Jan 16, 2012 1:19am

    John Henry Donovan

    12339 posts

    Hi Caroline,

    What version and build of EE are you using? there has been issues in the past with DST etc in earlier versions. It would help if you were not on latest to do an upgrade so we can troubleshoot from same version.

    How did you bring the WP entries into EE? Did you use an add-on or was this a manual process?

  • #3 / Jan 16, 2012 2:13pm

    John Henry! Hello-

    the version info:  Freelancer v2.2.2 - Build: date 20110801 - © Copyright 2003 - 2011 EllisLab, Inc.

    I’ll upgrade it to commercial. The site carries a license though it looks like my associate didn’t bother re-downloading the software to install the commercial version.

    I handled the import manually via SQL queries. I pulled the dates out of wordpress like:

    Select UNIX_TIMESTAMP(date) as date

    .. and didn’t further mess with the information after I extracted it for EE from WP.

    It doesn’t look like WP is the problem as it seems that the two methods are interpreting the same date independently using different combinations of settings. That’s just what I see, though.

    Thanks for your attention to this.

    EDIT: After update, Calendar is delivering duplicate cells for two entries in one day. Please see attached image.

  • #4 / Jan 23, 2012 5:50pm

    Dan Decker

    7338 posts

    Hi .carolinecblaker.,

    I’m sorry to see you having so much trouble with dates and ExpressionEngine. There are several places in the Control Panel that ExpressionEngine stores localization info, and how those relate can be a bit confusing.

    First, there is the Server time zone setting in Admin-> Localization Settings You mentioned you have yours set for Mountain Time in the US, as well as a Server offset of “200”, so you have set the server 2hrs and 20 mins off from the timezone it is located in. In general, you would not have to worry about supplying an offset because…

    The user/member also has localization settings tied to their member account. Under Members-> View All: Username you can set the Localization Settings for the user independently of the system, so for your client you would set them in the Pacific Timezone.

    If you want to make the adjustments to the entry dates that you mentioned, the timestamp is stored in exp_channel_titles under the entry_date column, but there is no easy way to make that change without a custom query.

    Now, for your calendar woes, can you post the template code you are using to display the calendar you are having trouble with? That would aid in troubleshooting this out.

    Thanks!

  • #5 / Jan 24, 2012 12:57pm

    Hi Dan,

    Thanks for your response.

    It looks like the update corrected our issue, with the exception of about 20 dates that occurred right around the turn of the month - so in a funny sort of way, these were both easy to find and not patterned in any way - so we fixed these by hand and that was it.

    The calendar bug is still a problem though. - Again, it’s showing a day per entry, so the calendar display is being thrown off. Here is the code:

    {exp:channel:calendar channel="news"  start_on="{segment_3}-{segment_4}-{segment_5} 00:00"}
       <div id="bodyCal">
        <table> 
         <thead>
          <tr> 
           <th>Sun</th>
           <th>Mon</th>
           <th>Tue</th>
           <th>Wed</th>
           <th>Thu</th>
           <th>Fri</th>
           <th class="last">Sat</th>
          </tr> 
         </thead>
         <tbody>
           {calendar_rows }
         {row_start} <tr id="row_<?php echo $count; $count++;?>" class="days">{/row_start}
          {if entries}
    
                   
                    {entries }
                                <td id="cell_{day_number}" class="day">
                   <a href="#post0{entry_id}" title="{day_number}" class="entry_cell">{day_number}</a>
                   <span class="entry_id">{entry_id}</span>
        
                      </td>
                    {/entries}
             
            {/if}
            {if not_entries}
                <td class='comicOff ' class="day " >{day_number} </td>
            {/if}
             {if blank}
                <td class='comicOff ' class="day ">{day_number} </td>
            {/if}
          {row_end}</tr>{/row_end}
            {/calendar_rows}
         </tbody>
        </table>
       </div>
       <hr >
      {/exp:channel:calendar}
  • #6 / Jan 29, 2012 3:34pm

    Dan Decker

    7338 posts

    Hi .carolinecblaker.,

    Let’s simplify things a bit for troubleshooting’s sake. If you take out the start_on= parameter and let the calendar run without that, are you still seeing duplicate entries?

    Also, I can infer that the month, day and year are being supplied in your segment variables, but where are they coming from to be included in the URL?

    Thanks

  • #7 / Jan 30, 2012 3:25pm

    Hey Dan,

    First: yes, taking the start-on parameter out, yields the same results: (see image attached note the 2 11’s)

    Next: All of the links are system generated. Even when there aren’t places for all those segments, it gets hit by the following:

    {if segment_3==""}
    {exp:channel:entries channel="news" orderby="date" sort="desc" limit="1"}
      {redirect="/archive/news/{entry_date format="%Y/%m/%d"}"}
     {/exp:channel:entries}
     {/if}
    {if segment_5 == ""}
     {exp:channel:entries channel="news" orderby="date" sort="asc" limit="1" year="{segment_3}" month="{segment_4}"}
      {redirect="/archive/news/{entry_date format="%Y/%m/%d"}"}
     {/exp:channel:entries}
    {/if}

    EDIT: Thanks for your attention to this 😊

  • #8 / Feb 04, 2012 5:37pm

    Dan Decker

    7338 posts

    Hey Caroline,

    Looking over your calendar code, I noticed something odd inside the {if entries} tag:

    {entries}
      <td id="cell_{day_number}" class="day">
       <a href="#post0{entry_id}" title="{day_number}" class="entry_cell">{day_number}</a>
       <span class="entry_id">{entry_id}</span>
      </td>
    {/entries}

    I don’t think {entries}{/entries} is a valid tag pair and may be the source of the problem here.
    If you go with just:

    {if entries}
      <td id="cell_{day_number}" class="day">
       <a href="#post0{entry_id}" title="{day_number}" class="entry_cell">{day_number}</a>
       <span class="entry_id">{entry_id}</span>
      </td>
    {/if}

    Do the repeats stop?

    Cheers!

  • #9 / Mar 01, 2012 3:19pm

    No - what that did was make it not parse all together.

    I went in and hacked this - I inserted a “limit 1” in the query - and now it works.

    That should really be in there already! At least as a paramter.

    CCB

  • #10 / Mar 02, 2012 3:58pm

    Dan Decker

    7338 posts

    Hi .carolinecblaker.,

    Well, you and I are 3 for 3 today, but I think you are the one winning here 😊

    You’re right, it should be a parameter. Feel like making it a Feature Request? If you need robust control over calendaring, there is always Solspace’s Calendar module.

    Is there anything else I can help you with?

    Cheers,

  • #11 / Mar 02, 2012 4:30pm

    http://ellislab.com/forums/viewthread/212350/ Requested!

    Thanks so much Dan!

  • #12 / Mar 02, 2012 8:10pm

    Sean C. Smith

    3818 posts

    Caroline,

    Good to see that Dan was able to get you all sorted out. I’m going to close out this thread, but feel free to post again when you have more questions.

    Sean

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases