From 62a649b9f8c548def5964811af5e82f33f6d6859 Mon Sep 17 00:00:00 2001 From: Kai Fukushima <38278379+foolishell@users.noreply.github.com> Date: Wed, 28 Aug 2024 11:04:47 +0900 Subject: [PATCH] fix: Date range 0.. to 1.. --- fake/src/impls/chrono/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fake/src/impls/chrono/mod.rs b/fake/src/impls/chrono/mod.rs index 056d82f..c6b2605 100644 --- a/fake/src/impls/chrono/mod.rs +++ b/fake/src/impls/chrono/mod.rs @@ -55,7 +55,7 @@ where impl Dummy for Date { fn dummy_with_rng(_: &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) @@ -73,7 +73,7 @@ impl Dummy for NaiveTime { impl Dummy for NaiveDate { fn dummy_with_rng(_: &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)