Crates.io: Crates.io should output dates with timezone info in JSON

Created on 11 Oct 2017  路  6Comments  路  Source: rust-lang/crates.io

I just published a new version of one of my crates and the page shows "Last Updated: in 7 hours".


selection_070

A-backend C-bug

All 6 comments

I'd guess this is timezone related.

@sgrif i thought diesel was setting UTC for everything?

API response for https://crates.io/api/v1/crates/isatty is currently showing:

{"crate":{"id":"isatty","name":"isatty","updated_at":"2017-10-11T17:25:24.150309"

Are you in UTC-8, @dtolnay ? Maybe this is a frontend problem where it's interpreting no timezone as local timezone and should be assuming UTC instead....

It looks like #1081 has converted every Timespec into NaiveDateTime, which lacks timezone information. I think it is better to stick to DateTime<Utc> to keep the timestamps well ordered.

This issue affects other tools that use crates.io API, such as cargo-info. It expects the timestamps to have timezone data. See below - the RELEASED field is blank:

cargo info cargo

Crate:          cargo
Version:        0.22.0
Description:    Cargo, a package manager for Rust.

Downloads:      47417
Homepage:       https://crates.io
Documentation:  https://docs.rs/cargo
Repository:     https://github.com/rust-lang/cargo
Last updated:
Version history:

  VERSION    RELEASED        DOWNLOADS

  0.22.0                     19
  0.21.1                     1062
  0.21.0                     230
  0.20.0                     1681
  0.19.0                     3721

  ... use -VV to show all 22 versions

@imp in PR #1146 I have a patch which I believe will resolve this issue. I've cloned cargo-info and tested it against a local server. It appears to work correctly for me both with and without the workaround you applied in imp/cargo-info@c36c6df55cd48fe131dfc549ec3d2b01d80e1770.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

vignesh-sankaran picture vignesh-sankaran  路  5Comments

pczarn picture pczarn  路  7Comments

tomaka picture tomaka  路  6Comments

seeekr picture seeekr  路  7Comments

mleonhard picture mleonhard  路  5Comments