Skip to content
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

extend weather block to show sunset and sunrise #2028

Merged
merged 2 commits into from
Nov 15, 2024

Conversation

sMailund
Copy link
Contributor

@sMailund sMailund commented Mar 27, 2024

ref #715
image

Opted to include into existing weather block instead of creating standalone block.
Implemented for both OpenWeatherMap and MetNo providers

src/blocks/weather/open_weather_map.rs Outdated Show resolved Hide resolved
src/blocks/weather.rs Show resolved Hide resolved
src/blocks/weather/open_weather_map.rs Outdated Show resolved Hide resolved
src/blocks/weather/met_no.rs Show resolved Hide resolved
src/blocks/weather.rs Outdated Show resolved Hide resolved
src/blocks/weather/met_no.rs Outdated Show resolved Hide resolved
src/blocks/weather/met_no.rs Outdated Show resolved Hide resolved
@bim9262
Copy link
Collaborator

bim9262 commented Sep 6, 2024

I did a little POC to get the date based on the lat/long so that we can pass that to metno.

Add tz-search as a dependency

use chrono::Utc;
use chrono_tz::Tz;

fn main() {
    let (lat, long) = (30., -97.);
    let tz: Tz = tz_search::lookup(lat, long).unwrap().parse().unwrap();
    let date = Utc::now().with_timezone(&tz).format("%Y-%m-%d");
    println!("{}", date);
}

Obviously we'd want to swap out those unwraps for error("")?s

@bim9262
Copy link
Collaborator

bim9262 commented Oct 20, 2024

@sMailund would you like to continue work on this? If not I can take it over.

@sMailund
Copy link
Contributor Author

@bim9262 been meaning to get back to this for a while, but not able to get the time for it! Feel free to take over if you want to!

@bim9262 bim9262 force-pushed the sunset branch 2 times, most recently from 82075f0 to 319c523 Compare October 21, 2024 23:31
@bim9262
Copy link
Collaborator

bim9262 commented Oct 21, 2024

@sMailund, I squashed your commits, and rebased them onto master + added one new commit to add the sunset to the nws provider + rearrange a bit for the rebase. Feel free to check it out/test

src/blocks/weather.rs Outdated Show resolved Hide resolved
@bim9262 bim9262 merged commit 08139b9 into greshake:master Nov 15, 2024
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants