ginader / easychirp

easychirp.com - Web accessibility for the Twitter website application
11 stars 1 forks source link

tweet times wrong #137

Closed weboverhauls closed 10 years ago

weboverhauls commented 10 years ago

Getting reports that the time on tweets is wrong. Trying to get more details.

Reference issue #90

weboverhauls commented 10 years ago

Can you get to this next? Getting reports from users...

andrewwoods commented 10 years ago

Whenever, I login it looks right. Do you have more information about the users, particularly where they are and what timezone they're in. Basically I need some test cases of data to help figure out what's wrong.

andrewwoods commented 10 years ago

I created a new test page http://easychirp.local/test to help diagnose the wrong tweet times. the way the tweet times work is that if it cant identify the user's time zone (which comes from their twitter profile and is in their session), it uses the 'America/Los Angeles' timezone. Here's a list of all the timezones http://www.php.net/manual/en/timezones.php

weboverhauls commented 10 years ago

I suggest not using the time zone but the offset instead. That's how it worked in EC1.

weboverhauls commented 10 years ago

Hey, the times are missing am/pm. I tried fixing, but seems Codeignitor doesn't support the necessary strftime code (%P). Thoughts?

andrewwoods commented 10 years ago

I noticed it too. both %P and %p didn't render correctly. So I left it off on purpose. It's better not to show something than to show something incorrect. Personally, I'd rather read the time as 22:00 than 10:00 pm.

weboverhauls commented 10 years ago

That sucks. I really prefer the am/pm. I did some investigation. This isn't perfect, but looks like we can do something like the following. Can you perfect?

function reformat_date($date, $time_zone)
{
    $twitter_date_format = 'D M d H:i:s e Y';
    $tweet_date = DateTime::createFromFormat($twitter_date_format, $date);
    $tweet_time = strtotime($tweet_date->format('Y-m-d h:i:s'));
    $tweet_time = $tweet_time + $time_zone;

    $ampm = (($tweet_time%86400) < 43200 ? ' am' : ' pm');

    $date = strftime(DISPLAY_DATETIME_STRFTIME_FORMAT, $tweet_time);

    return $date . $ampm;
}
weboverhauls commented 10 years ago

Andrew, tweet times are off by 2 hours on production but locally is ok. Can you check this?

weboverhauls commented 10 years ago

still borked...tbc