mirror of
https://github.com/fafhrd91/actix-web
synced 2025-06-26 06:57:43 +02:00
Replace deprecated now with now_utc (#1481)
* Replace deprecated now with now_utc * Update doctest
This commit is contained in:
@ -63,7 +63,7 @@ impl CookieBuilder {
|
||||
/// use actix_http::cookie::Cookie;
|
||||
///
|
||||
/// let c = Cookie::build("foo", "bar")
|
||||
/// .expires(time::OffsetDateTime::now())
|
||||
/// .expires(time::OffsetDateTime::now_utc())
|
||||
/// .finish();
|
||||
///
|
||||
/// assert!(c.expires().is_some());
|
||||
|
@ -221,7 +221,7 @@ impl CookieJar {
|
||||
if self.original_cookies.contains(cookie.name()) {
|
||||
cookie.set_value("");
|
||||
cookie.set_max_age(Duration::zero());
|
||||
cookie.set_expires(OffsetDateTime::now() - Duration::days(365));
|
||||
cookie.set_expires(OffsetDateTime::now_utc() - Duration::days(365));
|
||||
self.delta_cookies.replace(DeltaCookie::removed(cookie));
|
||||
} else {
|
||||
self.delta_cookies.remove(cookie.name());
|
||||
|
@ -733,7 +733,7 @@ impl<'c> Cookie<'c> {
|
||||
pub fn make_permanent(&mut self) {
|
||||
let twenty_years = Duration::days(365 * 20);
|
||||
self.set_max_age(twenty_years);
|
||||
self.set_expires(OffsetDateTime::now() + twenty_years);
|
||||
self.set_expires(OffsetDateTime::now_utc() + twenty_years);
|
||||
}
|
||||
|
||||
fn fmt_parameters(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
|
Reference in New Issue
Block a user