-
-
Notifications
You must be signed in to change notification settings - Fork 774
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: caches weather with redis & info tooltip #358
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't had time to test this locally, but good work! 👍
if (!cachedWeatherData) { | ||
const weatherData = await getCurrentWeatherData(input); | ||
const secondsUntilMidnight = Math.round( | ||
(new Date().setHours(24, 0, 0, 0) - Date.now()) / 1000, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a quite long and confusing line. The code below isn't shorter, but it is more understandable!
import { Interval, DateTime } from "luxon"
const secondsUntilMidnight = Interval.fromDateTimes(
DateTime.now(),
DateTime.now().endOf("day")
).length("seconds")
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this alternative ✅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tbh I would rather not need to install another package into the project and for maintenance sake, just use what javascript gave us out of the box, the variable naming is very descriptive of what the operation does so I don't think we necessarily need luxon.
Closes #355, please link |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good on my end!
* feat: caches weather with redis & info tooltip * refactor: literally dropped by 50 lines
Closes #355
This PR aims to do the following: