gereleth / hexapipes

Hexagonal pipes puzzles
https://hexapipes.vercel.app/hexagonal/5
MIT License
186 stars 19 forks source link

Consider making daily puzzles start at midnight in the local timezone #55

Closed adamburgess closed 8 months ago

adamburgess commented 2 years ago

Currently the UTC time is used.

I tried solving this, but I'm not too familiar with svelte. (and, side note, vanilla js dates make me sad)

One downside with this approach: this will server-render the data for the UTC game, but the client may need a different date, leading to an extra fetch for the local timezone's game upon load.

vercel[bot] commented 2 years ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
hexapipes ✅ Ready (Inspect) Visit Preview Aug 29, 2022 at 1:55PM (UTC)
gereleth commented 2 years ago

I am considering this.

I haven't tested your code but I guess it would be better to not render the daily on the server at all if local time is to be used. I wouldn't want to see a glimpse of one puzzle and then be shown a different one.

And I think I'd need to put a warning on the daily page about such a change for a few days before actually applying it. If unannounced this could interrupt people's streaks. I'm afraid the interruption can still happen even with a warning so I'm a bit hesitant)).

adamburgess commented 2 years ago

I hadn't considered the double rendering, hmm... One way would be to use vercel's x-vercel-ip-timezone header to predict the timezone on the server, which would hopefully work in most cases

As for the streak, a very very silly way would be to use a similar technique to leap smearing, but over a very long period 🙂

The simplest method I can think of is to change it over on a specific date and then give ±2 days of leeway to missed puzzles (but then your hard work of generating these puzzles could be missed, so not the best solution..)