From 881ff2cd4460c61d309ccfb2367f460be6d9f8de Mon Sep 17 00:00:00 2001 From: Justin Geibel Date: Wed, 28 Feb 2018 20:15:31 -0500 Subject: [PATCH] Change date format in build-info ordering and use SVG instead of PNG The NaiveDate type doesn't include any time or timezone information, so I'm explicitly formatting as year-month-day ("%Y-%m-%d"). --- app/templates/crate/build-info.hbs | 2 +- src/tests/version.rs | 4 ++-- src/version/metadata.rs | 18 +++++++++--------- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/app/templates/crate/build-info.hbs b/app/templates/crate/build-info.hbs index d52fdd2975d..05b337d6d2c 100644 --- a/app/templates/crate/build-info.hbs +++ b/app/templates/crate/build-info.hbs @@ -7,7 +7,7 @@
- +

Build info for {{ name }}

{{ version }}

diff --git a/src/tests/version.rs b/src/tests/version.rs index bdd9dfe7830..e1fc45b6ffb 100644 --- a/src/tests/version.rs +++ b/src/tests/version.rs @@ -204,7 +204,7 @@ fn publish_build_info() { let json = ::json::(&mut response); - let nightly_key_string = String::from("2017-01-25T00:00:00+00:00"); + let nightly_key_string = String::from("2017-01-25"); assert_eq!( json.build_info.ordering.get("nightly"), Some(&vec![nightly_key_string.clone()]) @@ -218,7 +218,7 @@ fn publish_build_info() { vec![nightly_key_string] ); - let beta_key_string = String::from("2017-01-20T00:00:00+00:00"); + let beta_key_string = String::from("2017-01-20"); assert_eq!( json.build_info.ordering.get("beta"), Some(&vec![beta_key_string.clone()]) diff --git a/src/version/metadata.rs b/src/version/metadata.rs index bcd58af9cdf..2e09d2ace48 100644 --- a/src/version/metadata.rs +++ b/src/version/metadata.rs @@ -7,7 +7,7 @@ use std::str::FromStr; -use chrono::{DateTime, NaiveDate, Utc}; +use chrono::NaiveDate; use conduit::{Request, Response}; use diesel::prelude::*; @@ -81,8 +81,8 @@ pub fn authors(req: &mut Request) -> CargoResult { // "build_info": { // "id": 1, // "ordering": { -// "nightly": ["2017-07-26T00:00:00Z"], -// "beta": ["2017-07-18T00:00:00Z"], +// "nightly": ["2017-07-26"], +// "beta": ["2017-07-18"], // "stable": ["1.19.0"] // }, // "stable": { @@ -91,10 +91,10 @@ pub fn authors(req: &mut Request) -> CargoResult { // "1.18.0": { "x86_64-pc-windows-gnu": false } // }, // "beta": { -// "2017-07-18T00:00:00Z": { "x86_64-apple-darwin": false } +// "2017-07-18": { "x86_64-apple-darwin": false } // }, // "nightly": { -// "2017-07-26T00:00:00Z": { "x86_64-apple-darwin": true } +// "2017-07-26": { "x86_64-apple-darwin": true } // } // } // } @@ -159,18 +159,18 @@ pub fn build_info(req: &mut Request) -> CargoResult { stables.into_iter().map(|s| s.to_string()).collect(), ); - fn naive_date_to_rfc3339(date: NaiveDate) -> String { - DateTime::::from_utc(date.and_hms(0, 0, 0), Utc).to_rfc3339() + fn naive_date_to_string(date: NaiveDate) -> String { + date.format("%Y-%m-%d").to_string() } encodable_build_info.ordering.insert( String::from("beta"), - betas.into_iter().map(naive_date_to_rfc3339).collect(), + betas.into_iter().map(naive_date_to_string).collect(), ); encodable_build_info.ordering.insert( String::from("nightly"), - nightlies.into_iter().map(naive_date_to_rfc3339).collect(), + nightlies.into_iter().map(naive_date_to_string).collect(), ); #[derive(Serialize, Debug)]