espresto/reclaim-social-media

foursquare checkins date wrong

Closed this issue · 2 comments

My 4sq check-ins have a wrong date (+48h).
http://nxd4n.nixekinder.be/?p=3314
http://4sq.com/1esTzsN

I checked server date/time, seems to be ok. Other posts are published with correct time.

yes. it seems to be this code change: 71e2707
i had a checkin on feb. 6 10:19. foursquare's api response is:

createdAt: 1391678351,
timeZoneOffset: 60,

this got handled right with

get_date_from_gmt(date('Y-m-d H:i:s', $checkin["createdAt"]))

now it's:

date('Y-m-d H:i:s', $checkin["createdAt"] + ($checkin['timeZoneOffset'] * HOUR_IN_SECONDS ) - get_option( 'gmt_offset' ) * HOUR_IN_SECONDS);

this returns
1391678351 + (60 * 3600) - (1 * 3600) => 1391890751
what would be 08.02.2014 - 21:19:11 insead of 06.02.2014 - 10:19:11
so the mistake is multiplying foursquares timeZoneOffset which is in minutes with 3600. it should be 60 instead
1391678351 + (60 * 60) - (1 * 3600) => 06.02.2014 - 10:19:11
i'll correct it with the next commit.

solved by 0f8bf52 (i hope)