Skip to content

Commit

Permalink
Merge pull request #191 from foolishell/master
Browse files Browse the repository at this point in the history
fix: chrono Date range `0..` to `1..`
  • Loading branch information
cksac authored Aug 28, 2024
2 parents 93c02c0 + 62a649b commit adee7cf
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions fake/src/impls/chrono/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ where

impl Dummy<Faker> for Date<Utc> {
fn dummy_with_rng<R: Rng + ?Sized>(_: &Faker, rng: &mut R) -> Self {
let year: i32 = (0..YEAR_MAG).fake_with_rng(rng);
let year: i32 = (1..YEAR_MAG).fake_with_rng(rng);
let end = if is_leap(year) { 366 } else { 365 };
let day_ord: u32 = (1..end).fake_with_rng(rng);
Utc.yo(year, day_ord)
Expand All @@ -73,7 +73,7 @@ impl Dummy<Faker> for NaiveTime {

impl Dummy<Faker> for NaiveDate {
fn dummy_with_rng<R: Rng + ?Sized>(_: &Faker, rng: &mut R) -> Self {
let year: i32 = (0..YEAR_MAG).fake_with_rng(rng);
let year: i32 = (1..YEAR_MAG).fake_with_rng(rng);
let end = if is_leap(year) { 366 } else { 365 };
let day_ord: u32 = (1..end).fake_with_rng(rng);
NaiveDate::from_yo(year, day_ord)
Expand Down

0 comments on commit adee7cf

Please sign in to comment.