Skip to content

Commit fe08d35

Browse files
committed
Fix to use PDT time for request params
1 parent 467a615 commit fe08d35

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lib/statistics/client.rb

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,11 @@ def fetch_events(group_id:, since_at: nil, until_at: nil)
123123
fields: %i(attending_count start_time owner),
124124
limit: 100
125125
}.tap do |h|
126-
h[:since] = (since_at.utc + since_at.utc_offset).to_i if since_at
127-
h[:until] = (until_at.utc + until_at.utc_offset).to_i if until_at
126+
# @note FacebookのGraph APIはPDTがタイムゾーンとなっており、
127+
# JST<->PDTのオフセット8時間を追加した時刻をパラメータとする必要がある
128+
# @see https://github.com/coderdojo-japan/coderdojo.jp/pull/182#discussion_r148935458
129+
h[:since] = since_at.since(8.hours).to_i if since_at
130+
h[:until] = until_at.since(8.hours).to_i if until_at
128131
end
129132

130133
events = []

0 commit comments

Comments
 (0)