I am trying to update the copyright year in yew wasm (rust). This is the below code I am trying but it does not work unfortunately.
use yew::prelude::*;
use chrono::prelude::*;
#[function_component(Footer)]
pub fn footer() -> Html
{
let current_date = chrono::Utc::now().date();
html!
{
<>
<div class={ "static bottom-0 bg-[#fff] opacity-90 container mx-auto max-w-3xl py-8" }>
<footer>
<div class={ "flex justify-center space-x-4" }>
<h1>{ format!("Copyright {} Name. All Rights Reserved.", current_date.year()) }</h1>
</div>
</footer>
</div>
</>
}
}
I was wondering how do I make this work without getting errors.
I am using trunk serve where in it does not show any errors but the page it self does not load when I use this specific code.
Is your post showing the full program? If not, Can you post it?
In meantime, try to replace the below line:
{ format!("Copyright {} Name. All Rights Reserved.", current_date.year()) }
with this line:
"Copyright {current_date.year()} Name. All Rights Reserved."