Lines Matching refs:from_ymd
112 let calculated_min = NaiveDate::from_ymd(MIN_YEAR, 1, 1); in test_date_bounds()
113 let calculated_max = NaiveDate::from_ymd(MAX_YEAR, 12, 31); in test_date_bounds()
172 pub fn from_ymd(year: i32, month: u32, day: u32) -> NaiveDate { in from_ymd() method
475 let first = NaiveDate::from_ymd(year, month, 1).weekday(); in from_weekday_of_month_opt()
1723 assert_eq!(to_string(&NaiveDate::from_ymd(2014, 7, 24)).ok(), Some(r#""2014-07-24""#.into())); in test_encodable_json()
1724 assert_eq!(to_string(&NaiveDate::from_ymd(0, 1, 1)).ok(), Some(r#""0000-01-01""#.into())); in test_encodable_json()
1725 assert_eq!(to_string(&NaiveDate::from_ymd(-1, 12, 31)).ok(), Some(r#""-0001-12-31""#.into())); in test_encodable_json()
1738 assert_eq!(from_str(r#""2016-07-08""#).ok(), Some(NaiveDate::from_ymd(2016, 7, 8))); in test_decodable_json()
1739 assert_eq!(from_str(r#""2016-7-8""#).ok(), Some(NaiveDate::from_ymd(2016, 7, 8))); in test_decodable_json()
1740 assert_eq!(from_str(r#""+002016-07-08""#).ok(), Some(NaiveDate::from_ymd(2016, 7, 8))); in test_decodable_json()
1741 assert_eq!(from_str(r#""0000-01-01""#).ok(), Some(NaiveDate::from_ymd(0, 1, 1))); in test_decodable_json()
1742 assert_eq!(from_str(r#""0-1-1""#).ok(), Some(NaiveDate::from_ymd(0, 1, 1))); in test_decodable_json()
1743 assert_eq!(from_str(r#""-0001-12-31""#).ok(), Some(NaiveDate::from_ymd(-1, 12, 31))); in test_decodable_json()
1881 let d = NaiveDate::from_ymd(2014, 7, 24); in test_serde_bincode()
1916 let ymd = |y, m, d| NaiveDate::from_ymd(y, m, d); in test_date_from_yo()
1946 let ymd = |y, m, d| NaiveDate::from_ymd(y, m, d); in test_date_from_isoywd()
2017 assert_eq!(from_ndays_from_ce(1), Some(NaiveDate::from_ymd(1, 1, 1))); in test_date_from_num_days_from_ce()
2018 assert_eq!(from_ndays_from_ce(2), Some(NaiveDate::from_ymd(1, 1, 2))); in test_date_from_num_days_from_ce()
2019 assert_eq!(from_ndays_from_ce(31), Some(NaiveDate::from_ymd(1, 1, 31))); in test_date_from_num_days_from_ce()
2020 assert_eq!(from_ndays_from_ce(32), Some(NaiveDate::from_ymd(1, 2, 1))); in test_date_from_num_days_from_ce()
2021 assert_eq!(from_ndays_from_ce(59), Some(NaiveDate::from_ymd(1, 2, 28))); in test_date_from_num_days_from_ce()
2022 assert_eq!(from_ndays_from_ce(60), Some(NaiveDate::from_ymd(1, 3, 1))); in test_date_from_num_days_from_ce()
2023 assert_eq!(from_ndays_from_ce(365), Some(NaiveDate::from_ymd(1, 12, 31))); in test_date_from_num_days_from_ce()
2024 assert_eq!(from_ndays_from_ce(365 * 1 + 1), Some(NaiveDate::from_ymd(2, 1, 1))); in test_date_from_num_days_from_ce()
2025 assert_eq!(from_ndays_from_ce(365 * 2 + 1), Some(NaiveDate::from_ymd(3, 1, 1))); in test_date_from_num_days_from_ce()
2026 assert_eq!(from_ndays_from_ce(365 * 3 + 1), Some(NaiveDate::from_ymd(4, 1, 1))); in test_date_from_num_days_from_ce()
2027 assert_eq!(from_ndays_from_ce(365 * 4 + 2), Some(NaiveDate::from_ymd(5, 1, 1))); in test_date_from_num_days_from_ce()
2028 assert_eq!(from_ndays_from_ce(146097 + 1), Some(NaiveDate::from_ymd(401, 1, 1))); in test_date_from_num_days_from_ce()
2029 assert_eq!(from_ndays_from_ce(146097 * 5 + 1), Some(NaiveDate::from_ymd(2001, 1, 1))); in test_date_from_num_days_from_ce()
2030 assert_eq!(from_ndays_from_ce(719163), Some(NaiveDate::from_ymd(1970, 1, 1))); in test_date_from_num_days_from_ce()
2031 assert_eq!(from_ndays_from_ce(0), Some(NaiveDate::from_ymd(0, 12, 31))); // 1 BCE in test_date_from_num_days_from_ce()
2032 assert_eq!(from_ndays_from_ce(-365), Some(NaiveDate::from_ymd(0, 1, 1))); in test_date_from_num_days_from_ce()
2033 assert_eq!(from_ndays_from_ce(-366), Some(NaiveDate::from_ymd(-1, 12, 31))); // 2 BCE in test_date_from_num_days_from_ce()
2049 assert_eq!(ymwd(2018, 8, Weekday::Wed, 1), Some(NaiveDate::from_ymd(2018, 8, 1))); in test_date_from_weekday_of_month_opt()
2050 assert_eq!(ymwd(2018, 8, Weekday::Thu, 1), Some(NaiveDate::from_ymd(2018, 8, 2))); in test_date_from_weekday_of_month_opt()
2051 assert_eq!(ymwd(2018, 8, Weekday::Sun, 1), Some(NaiveDate::from_ymd(2018, 8, 5))); in test_date_from_weekday_of_month_opt()
2052 assert_eq!(ymwd(2018, 8, Weekday::Mon, 1), Some(NaiveDate::from_ymd(2018, 8, 6))); in test_date_from_weekday_of_month_opt()
2053 assert_eq!(ymwd(2018, 8, Weekday::Tue, 1), Some(NaiveDate::from_ymd(2018, 8, 7))); in test_date_from_weekday_of_month_opt()
2054 assert_eq!(ymwd(2018, 8, Weekday::Wed, 2), Some(NaiveDate::from_ymd(2018, 8, 8))); in test_date_from_weekday_of_month_opt()
2055 assert_eq!(ymwd(2018, 8, Weekday::Sun, 2), Some(NaiveDate::from_ymd(2018, 8, 12))); in test_date_from_weekday_of_month_opt()
2056 assert_eq!(ymwd(2018, 8, Weekday::Thu, 3), Some(NaiveDate::from_ymd(2018, 8, 16))); in test_date_from_weekday_of_month_opt()
2057 assert_eq!(ymwd(2018, 8, Weekday::Thu, 4), Some(NaiveDate::from_ymd(2018, 8, 23))); in test_date_from_weekday_of_month_opt()
2058 assert_eq!(ymwd(2018, 8, Weekday::Thu, 5), Some(NaiveDate::from_ymd(2018, 8, 30))); in test_date_from_weekday_of_month_opt()
2059 assert_eq!(ymwd(2018, 8, Weekday::Fri, 5), Some(NaiveDate::from_ymd(2018, 8, 31))); in test_date_from_weekday_of_month_opt()
2066 let d1 = NaiveDate::from_ymd(year, month, day); in test_date_fields()
2104 assert_eq!(NaiveDate::from_ymd(1582, 10, 15).weekday(), Weekday::Fri); in test_date_weekday()
2106 assert_eq!(NaiveDate::from_ymd(1875, 5, 20).weekday(), Weekday::Thu); in test_date_weekday()
2107 assert_eq!(NaiveDate::from_ymd(2000, 1, 1).weekday(), Weekday::Sat); in test_date_weekday()
2112 let d = NaiveDate::from_ymd(2000, 2, 29); in test_date_with_fields()
2113 assert_eq!(d.with_year(-400), Some(NaiveDate::from_ymd(-400, 2, 29))); in test_date_with_fields()
2115 assert_eq!(d.with_year(1600), Some(NaiveDate::from_ymd(1600, 2, 29))); in test_date_with_fields()
2117 assert_eq!(d.with_year(2000), Some(NaiveDate::from_ymd(2000, 2, 29))); in test_date_with_fields()
2119 assert_eq!(d.with_year(2004), Some(NaiveDate::from_ymd(2004, 2, 29))); in test_date_with_fields()
2122 let d = NaiveDate::from_ymd(2000, 4, 30); in test_date_with_fields()
2124 assert_eq!(d.with_month(1), Some(NaiveDate::from_ymd(2000, 1, 30))); in test_date_with_fields()
2126 assert_eq!(d.with_month(3), Some(NaiveDate::from_ymd(2000, 3, 30))); in test_date_with_fields()
2127 assert_eq!(d.with_month(4), Some(NaiveDate::from_ymd(2000, 4, 30))); in test_date_with_fields()
2128 assert_eq!(d.with_month(12), Some(NaiveDate::from_ymd(2000, 12, 30))); in test_date_with_fields()
2132 let d = NaiveDate::from_ymd(2000, 2, 8); in test_date_with_fields()
2134 assert_eq!(d.with_day(1), Some(NaiveDate::from_ymd(2000, 2, 1))); in test_date_with_fields()
2135 assert_eq!(d.with_day(29), Some(NaiveDate::from_ymd(2000, 2, 29))); in test_date_with_fields()
2139 let d = NaiveDate::from_ymd(2000, 5, 5); in test_date_with_fields()
2141 assert_eq!(d.with_ordinal(1), Some(NaiveDate::from_ymd(2000, 1, 1))); in test_date_with_fields()
2142 assert_eq!(d.with_ordinal(60), Some(NaiveDate::from_ymd(2000, 2, 29))); in test_date_with_fields()
2143 assert_eq!(d.with_ordinal(61), Some(NaiveDate::from_ymd(2000, 3, 1))); in test_date_with_fields()
2144 assert_eq!(d.with_ordinal(366), Some(NaiveDate::from_ymd(2000, 12, 31))); in test_date_with_fields()
2151 assert_eq!(NaiveDate::from_ymd(1, 1, 1).num_days_from_ce(), 1); in test_date_num_days_from_ce()
2155 NaiveDate::from_ymd(year, 1, 1).num_days_from_ce(), in test_date_num_days_from_ce()
2156 NaiveDate::from_ymd(year - 1, 12, 31).num_days_from_ce() + 1 in test_date_num_days_from_ce()
2163 let ymd = |y, m, d| NaiveDate::from_ymd(y, m, d); in test_date_succ()
2173 let ymd = |y, m, d| NaiveDate::from_ymd(y, m, d); in test_date_pred()
2184 let lhs = NaiveDate::from_ymd(y1, m1, d1); in test_date_add()
2185 let sum = ymd.map(|(y, m, d)| NaiveDate::from_ymd(y, m, d)); in test_date_add()
2214 let lhs = NaiveDate::from_ymd(y1, m1, d1); in test_date_sub()
2215 let rhs = NaiveDate::from_ymd(y2, m2, d2); in test_date_sub()
2233 let ymd = NaiveDate::from_ymd; in test_date_addassignment()
2243 let ymd = NaiveDate::from_ymd; in test_date_subassignment()
2253 assert_eq!(format!("{:?}", NaiveDate::from_ymd(2012, 3, 4)), "2012-03-04"); in test_date_fmt()
2254 assert_eq!(format!("{:?}", NaiveDate::from_ymd(0, 3, 4)), "0000-03-04"); in test_date_fmt()
2255 assert_eq!(format!("{:?}", NaiveDate::from_ymd(-307, 3, 4)), "-0307-03-04"); in test_date_fmt()
2256 assert_eq!(format!("{:?}", NaiveDate::from_ymd(12345, 3, 4)), "+12345-03-04"); in test_date_fmt()
2258 assert_eq!(NaiveDate::from_ymd(2012, 3, 4).to_string(), "2012-03-04"); in test_date_fmt()
2259 assert_eq!(NaiveDate::from_ymd(0, 3, 4).to_string(), "0000-03-04"); in test_date_fmt()
2260 assert_eq!(NaiveDate::from_ymd(-307, 3, 4).to_string(), "-0307-03-04"); in test_date_fmt()
2261 assert_eq!(NaiveDate::from_ymd(12345, 3, 4).to_string(), "+12345-03-04"); in test_date_fmt()
2264 assert_eq!(format!("{:+30?}", NaiveDate::from_ymd(1234, 5, 6)), "1234-05-06"); in test_date_fmt()
2265 assert_eq!(format!("{:30?}", NaiveDate::from_ymd(12345, 6, 7)), "+12345-06-07"); in test_date_fmt()
2321 let ymd = |y, m, d| NaiveDate::from_ymd(y, m, d); in test_date_parse_from_str()
2341 let d = NaiveDate::from_ymd(2012, 3, 4); in test_date_format()
2354 assert_eq!(NaiveDate::from_ymd(12345, 1, 1).format("%Y").to_string(), "+12345"); in test_date_format()
2355 assert_eq!(NaiveDate::from_ymd(1234, 1, 1).format("%Y").to_string(), "1234"); in test_date_format()
2356 assert_eq!(NaiveDate::from_ymd(123, 1, 1).format("%Y").to_string(), "0123"); in test_date_format()
2357 assert_eq!(NaiveDate::from_ymd(12, 1, 1).format("%Y").to_string(), "0012"); in test_date_format()
2358 assert_eq!(NaiveDate::from_ymd(1, 1, 1).format("%Y").to_string(), "0001"); in test_date_format()
2359 assert_eq!(NaiveDate::from_ymd(0, 1, 1).format("%Y").to_string(), "0000"); in test_date_format()
2360 assert_eq!(NaiveDate::from_ymd(-1, 1, 1).format("%Y").to_string(), "-0001"); in test_date_format()
2361 assert_eq!(NaiveDate::from_ymd(-12, 1, 1).format("%Y").to_string(), "-0012"); in test_date_format()
2362 assert_eq!(NaiveDate::from_ymd(-123, 1, 1).format("%Y").to_string(), "-0123"); in test_date_format()
2363 assert_eq!(NaiveDate::from_ymd(-1234, 1, 1).format("%Y").to_string(), "-1234"); in test_date_format()
2364 assert_eq!(NaiveDate::from_ymd(-12345, 1, 1).format("%Y").to_string(), "-12345"); in test_date_format()
2368 NaiveDate::from_ymd(2007, 12, 31).format("%G,%g,%U,%W,%V").to_string(), in test_date_format()
2372 NaiveDate::from_ymd(2010, 1, 3).format("%G,%g,%U,%W,%V").to_string(), in test_date_format()
2380 NaiveDate::from_ymd(262143, 12, 29).iter_days().take(4).collect::<Vec<_>>().len(), in test_day_iterator_limit()
2388 NaiveDate::from_ymd(262143, 12, 12).iter_weeks().take(4).collect::<Vec<_>>().len(), in test_week_iterator_limit()