Skip to content

Commit

Permalink
fix: Date range 0.. to 1..
Browse files Browse the repository at this point in the history
  • Loading branch information
foolishell committed Aug 28, 2024
1 parent 93c02c0 commit 62a649b
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 62a649b

Please sign in to comment.