Anniversaries: date off by one

I was very pleased this morning to see that it’s my cakeday (on the forum I administer):

And out of curiosity I went to see who else’s cakeday was nearby. Strangely, though, the anniversaries page seems to be a day in the past:

Could it be because I’m in GMT+8?

「いいね!」 5

That’s what I think.

Given that Discourse localizes the times it shows you everywhere else in the UI, I feel this is still a “bug” and should be fixed.

「いいね!」 3

So there are 24+ different cake day sets? That seems crazy.

That’s one way to look at it I guess. But I’m assuming the users are queried on page load, so there’s really only “one” set at a time.

Here’s a better example. The post you just made shows up for me as “June 8, 2017 12:45 AM”. If I was to fly across the country to California, I’d expect that post to show as “June 7, 2017 9:45 PM”.

「いいね!」 1

…and I just earned the “anniversary” badge this morning. This does feel like a bug to me.

Could it be mitigated by simply changing the timezone of the server to something more applicable for my community? We’re (mainly) in Australia, so processing everything as, say, GMT+8 or GMT+10 would make this all feel less odd.

Not a major issue, of course. :wink:

Since the server doesn’t know a user’s time zone, maybe the easiest fix for this would be to award the badge one day later? For some, that will mean they get it late, but that will probably not be experienced as a bug as much as an early award is.

Another option might be to simply specify in the UI that these times are based on the server’s time zone.

「いいね!」 1

地域に特化したコミュニティの文脈では、Discourse の「ケーキデイ」のタイムゾーンを指定できるようにするべきだと考えます。サーバーのタイムゾーンを変更することは、実際には私たちの範疇ではありません。

これは難しい問題で、現在ユーザーが「タイムゾーン」を指定できるようになったとしても、どう解決すればよいか確信が持てません。

例えば、2019 年 1 月 2 日の午前 8 時にオーストラリアのフォーラムに登録したとします。

  • 「ケーキデイ」に基づく 1 周年記念日は、2010 年 1 月 1 日となります。
  • 1 月 2 日の午前 8 時に記念日ページを訪れると、2 日ではなく 1 月 1 日の記念日が表示されてしまいます。

ここで求められているのは、ユーザーに定義された「ローカル」タイムゾーンを使用して、これらの事柄を処理することだと考えます。

つまり:

  • ユーザープロフィールのローカルタイムゾーンがオーストラリアである場合、1 周年記念日は 2019 年 1 月 1 日となるべきです。
  • 2 日に記念日ページを訪れた場合、2 日が表示されるべきです。

現時点では、単純な修正を支持します。つまり、記念日ページをレンダリングする際、ログイン中のユーザーのローカルタイムゾーンを参照し、UTC 現在の時刻の代わりにその日付を使用するというものです。これは非常に簡単な変更で、おそらく 2 行のコードで済むでしょう。

@techAPJ さん、これを対応していただけませんか。

「いいね!」 8

@tgxworld さんはすでに、以下のコミットでタイムゾーンオフセットを考慮するように修正したと思います。

および

編集:私は UTC+5:30 のタイムゾーンにいますが、オフセットは 6 時間です。そのため、23:30 から 00:00 の間にアカウントを作成したユーザーのいくつかの極端なケースが表示されています。調査中です。

「いいね!」 6

以下で修正済み:

「いいね!」 8