oops, README.md again has testing lines
This commit is contained in:
parent
e982cd1851
commit
7f5f176cce
|
@ -47,7 +47,6 @@ use chrono::{UTC, Local, DateTime};
|
||||||
|
|
||||||
let utc: DateTime<UTC> = UTC::now(); // e.g. `2014-11-28T12:45:59.324310806Z`
|
let utc: DateTime<UTC> = UTC::now(); // e.g. `2014-11-28T12:45:59.324310806Z`
|
||||||
let local: DateTime<Local> = Local::now(); // e.g. `2014-11-28T21:45:59.324310806+09:00`
|
let local: DateTime<Local> = Local::now(); // e.g. `2014-11-28T21:45:59.324310806+09:00`
|
||||||
# let _ = utc; let _ = local;
|
|
||||||
~~~~
|
~~~~
|
||||||
|
|
||||||
Alternatively, you can create your own date and time.
|
Alternatively, you can create your own date and time.
|
||||||
|
@ -80,14 +79,10 @@ Addition and subtraction is also supported.
|
||||||
The following illustrates most supported operations to the date and time:
|
The following illustrates most supported operations to the date and time:
|
||||||
|
|
||||||
~~~~ {.rust}
|
~~~~ {.rust}
|
||||||
# /* we intentionally fake the datetime...
|
|
||||||
use chrono::{UTC, Local, Datelike, Timelike, Weekday, Duration};
|
use chrono::{UTC, Local, Datelike, Timelike, Weekday, Duration};
|
||||||
|
|
||||||
// assume this returned `2014-11-28T21:45:59.324310806+09:00`:
|
// assume this returned `2014-11-28T21:45:59.324310806+09:00`:
|
||||||
let dt = Local::now();
|
let dt = Local::now();
|
||||||
# */ // up to here. we now define a fixed datetime for the illustrative purpose.
|
|
||||||
# use chrono::{UTC, FixedOffset, Offset, Datelike, Timelike, Weekday, Duration};
|
|
||||||
# let dt = FixedOffset::east(9*3600).ymd(2014, 11, 28).and_hms_nano(21, 45, 59, 324310806);
|
|
||||||
|
|
||||||
// property accessors
|
// property accessors
|
||||||
assert_eq!((dt.year(), dt.month(), dt.day()), (2014, 11, 28));
|
assert_eq!((dt.year(), dt.month(), dt.day()), (2014, 11, 28));
|
||||||
|
@ -141,7 +136,6 @@ whenever appropriate.
|
||||||
~~~~ {.rust}
|
~~~~ {.rust}
|
||||||
use chrono::{UTC, Local, Offset, LocalResult, Datelike, Weekday};
|
use chrono::{UTC, Local, Offset, LocalResult, Datelike, Weekday};
|
||||||
|
|
||||||
# // these *may* fail, but only very rarely. just rerun the test if you were that unfortunate ;)
|
|
||||||
assert_eq!(UTC::today(), UTC::now().date());
|
assert_eq!(UTC::today(), UTC::now().date());
|
||||||
assert_eq!(Local::today(), Local::now().date());
|
assert_eq!(Local::today(), Local::now().date());
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue