Skip to content

Commit 881ff2c

Browse files
committed
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").
1 parent 6cdb0e7 commit 881ff2c

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

app/templates/crate/build-info.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<div id='crates-heading'>
88
<div class="wide">
99
<div class='info'>
10-
<img class='logo crate' src="/assets/crate.png"/>
10+
<img class='logo crate' src="/assets/crate.svg"/>
1111
<h1>Build info for {{ name }}</h1>
1212
<h2>{{ version }}</h2>
1313
</div>

src/tests/version.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ fn publish_build_info() {
204204

205205
let json = ::json::<R>(&mut response);
206206

207-
let nightly_key_string = String::from("2017-01-25T00:00:00+00:00");
207+
let nightly_key_string = String::from("2017-01-25");
208208
assert_eq!(
209209
json.build_info.ordering.get("nightly"),
210210
Some(&vec![nightly_key_string.clone()])
@@ -218,7 +218,7 @@ fn publish_build_info() {
218218
vec![nightly_key_string]
219219
);
220220

221-
let beta_key_string = String::from("2017-01-20T00:00:00+00:00");
221+
let beta_key_string = String::from("2017-01-20");
222222
assert_eq!(
223223
json.build_info.ordering.get("beta"),
224224
Some(&vec![beta_key_string.clone()])

src/version/metadata.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
88
use std::str::FromStr;
99

10-
use chrono::{DateTime, NaiveDate, Utc};
10+
use chrono::NaiveDate;
1111
use conduit::{Request, Response};
1212
use diesel::prelude::*;
1313

@@ -81,8 +81,8 @@ pub fn authors(req: &mut Request) -> CargoResult<Response> {
8181
// "build_info": {
8282
// "id": 1,
8383
// "ordering": {
84-
// "nightly": ["2017-07-26T00:00:00Z"],
85-
// "beta": ["2017-07-18T00:00:00Z"],
84+
// "nightly": ["2017-07-26"],
85+
// "beta": ["2017-07-18"],
8686
// "stable": ["1.19.0"]
8787
// },
8888
// "stable": {
@@ -91,10 +91,10 @@ pub fn authors(req: &mut Request) -> CargoResult<Response> {
9191
// "1.18.0": { "x86_64-pc-windows-gnu": false }
9292
// },
9393
// "beta": {
94-
// "2017-07-18T00:00:00Z": { "x86_64-apple-darwin": false }
94+
// "2017-07-18": { "x86_64-apple-darwin": false }
9595
// },
9696
// "nightly": {
97-
// "2017-07-26T00:00:00Z": { "x86_64-apple-darwin": true }
97+
// "2017-07-26": { "x86_64-apple-darwin": true }
9898
// }
9999
// }
100100
// }
@@ -159,18 +159,18 @@ pub fn build_info(req: &mut Request) -> CargoResult<Response> {
159159
stables.into_iter().map(|s| s.to_string()).collect(),
160160
);
161161

162-
fn naive_date_to_rfc3339(date: NaiveDate) -> String {
163-
DateTime::<Utc>::from_utc(date.and_hms(0, 0, 0), Utc).to_rfc3339()
162+
fn naive_date_to_string(date: NaiveDate) -> String {
163+
date.format("%Y-%m-%d").to_string()
164164
}
165165

166166
encodable_build_info.ordering.insert(
167167
String::from("beta"),
168-
betas.into_iter().map(naive_date_to_rfc3339).collect(),
168+
betas.into_iter().map(naive_date_to_string).collect(),
169169
);
170170

171171
encodable_build_info.ordering.insert(
172172
String::from("nightly"),
173-
nightlies.into_iter().map(naive_date_to_rfc3339).collect(),
173+
nightlies.into_iter().map(naive_date_to_string).collect(),
174174
);
175175

176176
#[derive(Serialize, Debug)]

0 commit comments

Comments
 (0)