Add timezone client-hints#303
Conversation
kentcdodds
left a comment
There was a problem hiding this comment.
I love this. Just a few changes.
app/utils/client-hints.tsx
Outdated
| transform(value: string | null) { | ||
| return value ?? 'UTC' | ||
| }, |
There was a problem hiding this comment.
In this case, we don't need to transform the value at all and the fallback is already defined. I think we should not require the transform function. So let's remove it here.
| transform(value: string | null) { | |
| return value ?? 'UTC' | |
| }, |
This change may necessitate a small update in the code below.
app/utils/client-hints.tsx
Outdated
| [name in ClientHintNames]: ReturnType< | ||
| (typeof clientHints)[name]['transform'] | ||
| > | ||
| [name in ClientHintNames]: string |
There was a problem hiding this comment.
We lose some type-checking here. But couldn't think of a better way to do it.
There was a problem hiding this comment.
Ah yeah, we'll need to figure out how to have our cake and eat it too here 😅 If you can't work it out, then that's fine. I'll come back to this later when I find time. Thanks!
There was a problem hiding this comment.
Couldn't figure out :(
|
Why was this PR closed? I'd still like to have this feature eventually and I'd prefer you get git credit for your work :) I might recommend you make any future PRs from a non- |
|
My mistake. You are right, I should have done that from a non-main branch. I attempted to copy over the latest changes from epicweb-dev/epic-stack to rajeshg/epic-stack. |
|
Couldn't reopen this myself, since I lack the rights to reopen pull requests on this repo. I will submit a separate pull request, when I get a chance. |
|
I can't reopen it either because you created it from |
Full credits to @kiliman for this work. https://github.com/kiliman/epic-stack-time-zone
Client hints for timezone are a nice add. The approach is similar to the way themes are handled currently. CH-time-zone will be added to the cookies.
Test Plan
Checklist
Screenshots