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 Likes

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 Likes

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 Like

…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 Like

I think that in the context of a heavily localized community you should be allowed to specify the timezone for discourse cakeday. Changing the server timezone is not really something we can do.

This is tricky business and I am not sure how to solve it though, even now that we allow users to specify “timezones”.

If you signed up to a forum in Australia on the 2nd of Jan 2019 at 8am.

  • Your 1 year anniversary according to “cake day” will be 1st of Jan 2010

  • When you visit the anniversaries page at 8am on the 2nd of Jan you will see anniversaries from 1st of Jan 2010 instead of the 2nd.

I guess what we are asking here is to use “local” timezones as defined on users to account for stuff.

Meaning:

  • Your 1 year anniversary should be 1st of Jan 2019 cause your local timezone in your user profile is Australia.

  • When you visit the anniversaries page on the 2nd you should see the 2nd.


For now I think I support the trivial fix which is, when rendering the anniversaries page, look at the local timezone of the current user and use that date instead of the date of UTC now, for cases where a user is logged on. Should be pretty easy of a change, maybe 2 lines of code.

@techAPJ can you take this.

8 Likes

I believe @tgxworld already fixed this to consider timezone offset via:

https://github.com/discourse/discourse-cakeday/commit/c6fd1f08545e09d012a558494bddd368a5d4864d#diff-edec1c4b3a2ef7541c47f9f05c59fe41

and

https://github.com/discourse/discourse-cakeday/commit/15533c48275b5b5d9c79e288996c203093ad4173

EDIT: I am in timezone UTC+5:30 but have an offset of 6 hours, so I am seeing few edge cases for users who created account between 23:30 and 00:00. Looking into it.

6 Likes

Fixed via:

8 Likes