summaryrefslogtreecommitdiff
path: root/tests/tests.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/tests.rs')
-rw-r--r--tests/tests.rs427
1 files changed, 280 insertions, 147 deletions
diff --git a/tests/tests.rs b/tests/tests.rs
index ae607cf..f4460b2 100644
--- a/tests/tests.rs
+++ b/tests/tests.rs
@@ -2,12 +2,13 @@
extern crate two_timer;
use two_timer::{parse, Config};
extern crate chrono;
-use chrono::{Duration, TimeZone, Utc};
+use chrono::naive::NaiveDate;
+use chrono::{Duration, Local, TimeZone, Utc};
#[test]
fn always() {
- let alpha = chrono::MIN_DATE.and_hms_milli(0, 0, 0, 0);
- let omega = chrono::MAX_DATE.and_hms_milli(23, 59, 59, 999);
+ let alpha = chrono::naive::MIN_DATE.and_hms_milli(0, 0, 0, 0);
+ let omega = chrono::naive::MAX_DATE.and_hms_milli(23, 59, 59, 999);
for phrase in [
"always",
"ever",
@@ -26,7 +27,7 @@ fn always() {
#[test]
fn yesterday() {
- let now = Utc::now();
+ let now = Local::now().naive_local();
let (start, end, _) = parse("yesterday", Some(Config::new().now(now))).unwrap();
assert!(start < now);
assert!(end < now);
@@ -39,7 +40,7 @@ fn yesterday() {
#[test]
fn tomorrow() {
- let now = Utc::now();
+ let now = Local::now().naive_local();
let (start, end, _) = parse("tomorrow", Some(Config::new().now(now))).unwrap();
assert!(start > now);
assert!(end > now);
@@ -52,7 +53,7 @@ fn tomorrow() {
#[test]
fn today() {
- let now = Utc::now();
+ let now = Local::now().naive_local();
let (start, end, _) = parse("today", Some(Config::new().now(now))).unwrap();
assert!(start < now);
assert!(end > now);
@@ -66,7 +67,7 @@ fn today() {
#[test]
fn day_5_6_69_at_3_30_pm() {
- let then = Utc.ymd(1969, 5, 6).and_hms(15, 30, 0);
+ let then = NaiveDate::from_ymd(1969, 5, 6).and_hms(15, 30, 0);
for phrase in [
"at 3:30 PM on 5-6-69",
"3:30 p.m. on 5-6-69",
@@ -83,7 +84,7 @@ fn day_5_6_69_at_3_30_pm() {
#[test]
fn day_5_6_69_at_3_pm() {
- let then = Utc.ymd(1969, 5, 6).and_hms(15, 0, 0);
+ let then = NaiveDate::from_ymd(1969, 5, 6).and_hms(15, 0, 0);
for phrase in [
"at 3 PM on 5-6-69",
"3 p.m. on 5-6-69",
@@ -100,7 +101,7 @@ fn day_5_6_69_at_3_pm() {
#[test]
fn day_5_6_69_at_3_30_00_pm() {
- let then = Utc.ymd(1969, 5, 6).and_hms(15, 30, 0);
+ let then = NaiveDate::from_ymd(1969, 5, 6).and_hms(15, 30, 0);
for phrase in [
"at 3:30:00 PM on 5-6-69",
"3:30:00 p.m. on 5-6-69",
@@ -117,7 +118,7 @@ fn day_5_6_69_at_3_30_00_pm() {
#[test]
fn day_5_6_69_at_3_30_01_pm() {
- let then = Utc.ymd(1969, 5, 6).and_hms(15, 30, 1);
+ let then = NaiveDate::from_ymd(1969, 5, 6).and_hms(15, 30, 1);
for phrase in [
"at 3:30:01 PM on 5-6-69",
"3:30:01 p.m. on 5-6-69",
@@ -134,7 +135,7 @@ fn day_5_6_69_at_3_30_01_pm() {
#[test]
fn day_5_6_69_at_3_30_01_am() {
- let then = Utc.ymd(1969, 5, 6).and_hms(3, 30, 1);
+ let then = NaiveDate::from_ymd(1969, 5, 6).and_hms(3, 30, 1);
for phrase in [
"at 3:30:01 AM on 5-6-69",
"3:30:01 a.m. on 5-6-69",
@@ -151,8 +152,8 @@ fn day_5_6_69_at_3_30_01_am() {
#[test]
fn at_3_pm() {
- let now = Utc.ymd(1969, 5, 6).and_hms(16, 0, 0);
- let then = Utc.ymd(1969, 5, 6).and_hms(15, 0, 0);
+ let now = NaiveDate::from_ymd(1969, 5, 6).and_hms(16, 0, 0);
+ let then = NaiveDate::from_ymd(1969, 5, 6).and_hms(15, 0, 0);
for phrase in ["3 PM", "3 pm", "15"].iter() {
let (start, end, _) = parse(phrase, Some(Config::new().now(now))).unwrap();
assert_eq!(then, start);
@@ -162,8 +163,8 @@ fn at_3_pm() {
#[test]
fn at_3_00_pm() {
- let now = Utc.ymd(1969, 5, 6).and_hms(16, 0, 0);
- let then = Utc.ymd(1969, 5, 6).and_hms(15, 0, 0);
+ let now = NaiveDate::from_ymd(1969, 5, 6).and_hms(16, 0, 0);
+ let then = NaiveDate::from_ymd(1969, 5, 6).and_hms(15, 0, 0);
for phrase in ["3:00 PM", "3:00 pm", "15:00"].iter() {
let (start, end, _) = parse(phrase, Some(Config::new().now(now))).unwrap();
assert_eq!(then, start);
@@ -173,8 +174,8 @@ fn at_3_00_pm() {
#[test]
fn at_3_00_00_pm() {
- let now = Utc.ymd(1969, 5, 6).and_hms(16, 0, 0);
- let then = Utc.ymd(1969, 5, 6).and_hms(15, 0, 0);
+ let now = NaiveDate::from_ymd(1969, 5, 6).and_hms(16, 0, 0);
+ let then = NaiveDate::from_ymd(1969, 5, 6).and_hms(15, 0, 0);
for phrase in ["3:00:00 PM", "3:00:00 pm", "15:00:00"].iter() {
let (start, end, _) = parse(phrase, Some(Config::new().now(now))).unwrap();
assert_eq!(then, start);
@@ -184,8 +185,8 @@ fn at_3_00_00_pm() {
#[test]
fn at_3_pm_yesterday() {
- let now = Utc.ymd(1969, 5, 6).and_hms(14, 0, 0);
- let then = Utc.ymd(1969, 5, 5).and_hms(15, 0, 0);
+ let now = NaiveDate::from_ymd(1969, 5, 6).and_hms(14, 0, 0);
+ let then = NaiveDate::from_ymd(1969, 5, 5).and_hms(15, 0, 0);
for phrase in ["3 PM yesterday", "3 pm yesterday", "15 yesterday"].iter() {
let (start, end, _) = parse(phrase, Some(Config::new().now(now))).unwrap();
assert_eq!(then, start);
@@ -195,7 +196,7 @@ fn at_3_pm_yesterday() {
#[test]
fn alphabetic_5_6_69() {
- let then = Utc.ymd(1969, 5, 6).and_hms(0, 0, 0);
+ let then = NaiveDate::from_ymd(1969, 5, 6).and_hms(0, 0, 0);
for phrase in [
"May 6, 1969",
"May 6, '69",
@@ -238,7 +239,7 @@ fn alphabetic_5_6_69() {
#[test]
fn ymd_5_31_69() {
- let then = Utc.ymd(1969, 5, 31).and_hms(0, 0, 0);
+ let then = NaiveDate::from_ymd(1969, 5, 31).and_hms(0, 0, 0);
for phrase in [
"5-31-69",
"5/31/69",
@@ -331,8 +332,8 @@ fn leap_day() {
#[test]
fn may_1969() {
- let m1 = Utc.ymd(1969, 5, 1).and_hms(0, 0, 0);
- let m2 = Utc.ymd(1969, 6, 1).and_hms(0, 0, 0);
+ let m1 = NaiveDate::from_ymd(1969, 5, 1).and_hms(0, 0, 0);
+ let m2 = NaiveDate::from_ymd(1969, 6, 1).and_hms(0, 0, 0);
for phrase in ["May 1969", "May '69"].iter() {
let (start, end, _) = parse(phrase, None).unwrap();
assert_eq!(m1, start);
@@ -342,9 +343,9 @@ fn may_1969() {
#[test]
fn this_month() {
- let now = Utc.ymd(1969, 5, 6).and_hms(0, 0, 0);
- let d1 = Utc.ymd(1969, 5, 1).and_hms(0, 0, 0);
- let d2 = Utc.ymd(1969, 6, 1).and_hms(0, 0, 0);
+ let now = NaiveDate::from_ymd(1969, 5, 6).and_hms(0, 0, 0);
+ let d1 = NaiveDate::from_ymd(1969, 5, 1).and_hms(0, 0, 0);
+ let d2 = NaiveDate::from_ymd(1969, 6, 1).and_hms(0, 0, 0);
let (start, end, _) = parse("this month", Some(Config::new().now(now))).unwrap();
assert_eq!(d1, start);
assert_eq!(d2, end);
@@ -352,9 +353,9 @@ fn this_month() {
#[test]
fn next_month() {
- let now = Utc.ymd(1969, 5, 6).and_hms(0, 0, 0);
- let d1 = Utc.ymd(1969, 6, 1).and_hms(0, 0, 0);
- let d2 = Utc.ymd(1969, 7, 1).and_hms(0, 0, 0);
+ let now = NaiveDate::from_ymd(1969, 5, 6).and_hms(0, 0, 0);
+ let d1 = NaiveDate::from_ymd(1969, 6, 1).and_hms(0, 0, 0);
+ let d2 = NaiveDate::from_ymd(1969, 7, 1).and_hms(0, 0, 0);
let (start, end, _) = parse("next month", Some(Config::new().now(now))).unwrap();
assert_eq!(d1, start);
assert_eq!(d2, end);
@@ -362,9 +363,9 @@ fn next_month() {
#[test]
fn last_month() {
- let now = Utc.ymd(1969, 5, 6).and_hms(0, 0, 0);
- let d1 = Utc.ymd(1969, 4, 1).and_hms(0, 0, 0);
- let d2 = Utc.ymd(1969, 5, 1).and_hms(0, 0, 0);
+ let now = NaiveDate::from_ymd(1969, 5, 6).and_hms(0, 0, 0);
+ let d1 = NaiveDate::from_ymd(1969, 4, 1).and_hms(0, 0, 0);
+ let d2 = NaiveDate::from_ymd(1969, 5, 1).and_hms(0, 0, 0);
let (start, end, _) = parse("last month", Some(Config::new().now(now))).unwrap();
assert_eq!(d1, start);
assert_eq!(d2, end);
@@ -372,9 +373,9 @@ fn last_month() {
#[test]
fn this_year() {
- let now = Utc.ymd(1969, 5, 6).and_hms(0, 0, 0);
- let d1 = Utc.ymd(1969, 1, 1).and_hms(0, 0, 0);
- let d2 = Utc.ymd(1970, 1, 1).and_hms(0, 0, 0);
+ let now = NaiveDate::from_ymd(1969, 5, 6).and_hms(0, 0, 0);
+ let d1 = NaiveDate::from_ymd(1969, 1, 1).and_hms(0, 0, 0);
+ let d2 = NaiveDate::from_ymd(1970, 1, 1).and_hms(0, 0, 0);
let (start, end, _) = parse("this year", Some(Config::new().now(now))).unwrap();
assert_eq!(d1, start);
assert_eq!(d2, end);
@@ -382,9 +383,9 @@ fn this_year() {
#[test]
fn next_year() {
- let now = Utc.ymd(1969, 5, 6).and_hms(0, 0, 0);
- let d1 = Utc.ymd(1970, 1, 1).and_hms(0, 0, 0);
- let d2 = Utc.ymd(1971, 1, 1).and_hms(0, 0, 0);
+ let now = NaiveDate::from_ymd(1969, 5, 6).and_hms(0, 0, 0);
+ let d1 = NaiveDate::from_ymd(1970, 1, 1).and_hms(0, 0, 0);
+ let d2 = NaiveDate::from_ymd(1971, 1, 1).and_hms(0, 0, 0);
let (start, end, _) = parse("next year", Some(Config::new().now(now))).unwrap();
assert_eq!(d1, start);
assert_eq!(d2, end);
@@ -392,9 +393,9 @@ fn next_year() {
#[test]
fn last_year() {
- let now = Utc.ymd(1969, 5, 6).and_hms(0, 0, 0);
- let d1 = Utc.ymd(1968, 1, 1).and_hms(0, 0, 0);
- let d2 = Utc.ymd(1969, 1, 1).and_hms(0, 0, 0);
+ let now = NaiveDate::from_ymd(1969, 5, 6).and_hms(0, 0, 0);
+ let d1 = NaiveDate::from_ymd(1968, 1, 1).and_hms(0, 0, 0);
+ let d2 = NaiveDate::from_ymd(1969, 1, 1).and_hms(0, 0, 0);
let (start, end, _) = parse("last year", Some(Config::new().now(now))).unwrap();
assert_eq!(d1, start);
assert_eq!(d2, end);
@@ -402,9 +403,9 @@ fn last_year() {
#[test]
fn this_week() {
- let now = Utc.ymd(1969, 5, 6).and_hms(0, 0, 0);
- let d1 = Utc.ymd(1969, 5, 5).and_hms(0, 0, 0);
- let d2 = Utc.ymd(1969, 5, 12).and_hms(0, 0, 0);
+ let now = NaiveDate::from_ymd(1969, 5, 6).and_hms(0, 0, 0);
+ let d1 = NaiveDate::from_ymd(1969, 5, 5).and_hms(0, 0, 0);
+ let d2 = NaiveDate::from_ymd(1969, 5, 12).and_hms(0, 0, 0);
let (start, end, _) = parse("this week", Some(Config::new().now(now))).unwrap();
assert_eq!(d1, start);
assert_eq!(d2, end);
@@ -412,9 +413,9 @@ fn this_week() {
#[test]
fn next_week() {
- let now = Utc.ymd(1969, 5, 6).and_hms(0, 0, 0);
- let d1 = Utc.ymd(1969, 5, 12).and_hms(0, 0, 0);
- let d2 = Utc.ymd(1969, 5, 19).and_hms(0, 0, 0);
+ let now = NaiveDate::from_ymd(1969, 5, 6).and_hms(0, 0, 0);
+ let d1 = NaiveDate::from_ymd(1969, 5, 12).and_hms(0, 0, 0);
+ let d2 = NaiveDate::from_ymd(1969, 5, 19).and_hms(0, 0, 0);
let (start, end, _) = parse("next week", Some(Config::new().now(now))).unwrap();
assert_eq!(d1, start);
assert_eq!(d2, end);
@@ -422,9 +423,9 @@ fn next_week() {
#[test]
fn last_week() {
- let now = Utc.ymd(1969, 5, 6).and_hms(0, 0, 0);
- let d1 = Utc.ymd(1969, 4, 28).and_hms(0, 0, 0);
- let d2 = Utc.ymd(1969, 5, 5).and_hms(0, 0, 0);
+ let now = NaiveDate::from_ymd(1969, 5, 6).and_hms(0, 0, 0);
+ let d1 = NaiveDate::from_ymd(1969, 4, 28).and_hms(0, 0, 0);
+ let d2 = NaiveDate::from_ymd(1969, 5, 5).and_hms(0, 0, 0);
let (start, end, _) = parse("last week", Some(Config::new().now(now))).unwrap();
assert_eq!(d1, start);
assert_eq!(d2, end);
@@ -432,9 +433,9 @@ fn last_week() {
#[test]
fn this_week_sunday_starts() {
- let now = Utc.ymd(1969, 5, 6).and_hms(0, 0, 0);
- let d1 = Utc.ymd(1969, 5, 4).and_hms(0, 0, 0);
- let d2 = Utc.ymd(1969, 5, 11).and_hms(0, 0, 0);
+ let now = NaiveDate::from_ymd(1969, 5, 6).and_hms(0, 0, 0);
+ let d1 = NaiveDate::from_ymd(1969, 5, 4).and_hms(0, 0, 0);
+ let d2 = NaiveDate::from_ymd(1969, 5, 11).and_hms(0, 0, 0);
let (start, end, _) = parse(
"this week",
Some(Config::new().now(now).monday_starts_week(false)),
@@ -446,9 +447,9 @@ fn this_week_sunday_starts() {
#[test]
fn next_week_sunday_starts() {
- let now = Utc.ymd(1969, 5, 6).and_hms(0, 0, 0);
- let d1 = Utc.ymd(1969, 5, 11).and_hms(0, 0, 0);
- let d2 = Utc.ymd(1969, 5, 18).and_hms(0, 0, 0);
+ let now = NaiveDate::from_ymd(1969, 5, 6).and_hms(0, 0, 0);
+ let d1 = NaiveDate::from_ymd(1969, 5, 11).and_hms(0, 0, 0);
+ let d2 = NaiveDate::from_ymd(1969, 5, 18).and_hms(0, 0, 0);
let (start, end, _) = parse(
"next week",
Some(Config::new().now(now).monday_starts_week(false)),
@@ -460,9 +461,9 @@ fn next_week_sunday_starts() {
#[test]
fn last_week_sunday_starts() {
- let now = Utc.ymd(1969, 5, 6).and_hms(0, 0, 0);
- let d1 = Utc.ymd(1969, 4, 27).and_hms(0, 0, 0);
- let d2 = Utc.ymd(1969, 5, 4).and_hms(0, 0, 0);
+ let now = NaiveDate::from_ymd(1969, 5, 6).and_hms(0, 0, 0);
+ let d1 = NaiveDate::from_ymd(1969, 4, 27).and_hms(0, 0, 0);
+ let d2 = NaiveDate::from_ymd(1969, 5, 4).and_hms(0, 0, 0);
let (start, end, _) = parse(
"last week",
Some(Config::new().now(now).monday_starts_week(false)),
@@ -474,14 +475,14 @@ fn last_week_sunday_starts() {
#[test]
fn this_pay_period() {
- let now = Utc.ymd(1969, 5, 6).and_hms(0, 0, 0);
+ let now = NaiveDate::from_ymd(1969, 5, 6).and_hms(0, 0, 0);
// two-week pay period beginning about a year before "now" on a Sunday
let config = Config::new()
- .pay_period_start(Some(Utc.ymd(1968, 5, 5)))
+ .pay_period_start(Some(NaiveDate::from_ymd(1968, 5, 5)))
.pay_period_length(14)
.now(now);
- let d1 = Utc.ymd(1969, 5, 4).and_hms(0, 0, 0);
- let d2 = Utc.ymd(1969, 5, 18).and_hms(0, 0, 0);
+ let d1 = NaiveDate::from_ymd(1969, 5, 4).and_hms(0, 0, 0);
+ let d2 = NaiveDate::from_ymd(1969, 5, 18).and_hms(0, 0, 0);
let (start, end, _) = parse("this pay period", Some(config)).unwrap();
assert_eq!(d1, start);
assert_eq!(d2, end);
@@ -489,14 +490,14 @@ fn this_pay_period() {
#[test]
fn next_pay_period() {
- let now = Utc.ymd(1969, 5, 6).and_hms(0, 0, 0);
+ let now = NaiveDate::from_ymd(1969, 5, 6).and_hms(0, 0, 0);
// two-week pay period beginning about a year before "now" on a Sunday
let config = Config::new()
- .pay_period_start(Some(Utc.ymd(1968, 5, 5)))
+ .pay_period_start(Some(NaiveDate::from_ymd(1968, 5, 5)))
.pay_period_length(14)
.now(now);
- let d1 = Utc.ymd(1969, 5, 18).and_hms(0, 0, 0);
- let d2 = Utc.ymd(1969, 6, 1).and_hms(0, 0, 0);
+ let d1 = NaiveDate::from_ymd(1969, 5, 18).and_hms(0, 0, 0);
+ let d2 = NaiveDate::from_ymd(1969, 6, 1).and_hms(0, 0, 0);
let (start, end, _) = parse("next pay period", Some(config)).unwrap();
assert_eq!(d1, start);
assert_eq!(d2, end);
@@ -504,14 +505,14 @@ fn next_pay_period() {
#[test]
fn last_pay_period() {
- let now = Utc.ymd(1969, 5, 6).and_hms(0, 0, 0);
+ let now = NaiveDate::from_ymd(1969, 5, 6).and_hms(0, 0, 0);
// two-week pay period beginning about a year before "now" on a Sunday
let config = Config::new()
- .pay_period_start(Some(Utc.ymd(1968, 5, 5)))
+ .pay_period_start(Some(NaiveDate::from_ymd(1968, 5, 5)))
.pay_period_length(14)
.now(now);
- let d1 = Utc.ymd(1969, 4, 20).and_hms(0, 0, 0);
- let d2 = Utc.ymd(1969, 5, 4).and_hms(0, 0, 0);
+ let d1 = NaiveDate::from_ymd(1969, 4, 20).and_hms(0, 0, 0);
+ let d2 = NaiveDate::from_ymd(1969, 5, 4).and_hms(0, 0, 0);
let (start, end, _) = parse("last pay period", Some(config)).unwrap();
assert_eq!(d1, start);
assert_eq!(d2, end);
@@ -519,14 +520,14 @@ fn last_pay_period() {
#[test]
fn this_pay_period_weird() {
- let now = Utc.ymd(1969, 5, 6).and_hms(0, 0, 0);
+ let now = NaiveDate::from_ymd(1969, 5, 6).and_hms(0, 0, 0);
// two-week pay period beginning about a year *after* "now" on a Sunday
let config = Config::new()
- .pay_period_start(Some(Utc.ymd(1970, 4, 5)))
+ .pay_period_start(Some(NaiveDate::from_ymd(1970, 4, 5)))
.pay_period_length(14)
.now(now);
- let d1 = Utc.ymd(1969, 5, 4).and_hms(0, 0, 0);
- let d2 = Utc.ymd(1969, 5, 18).and_hms(0, 0, 0);
+ let d1 = NaiveDate::from_ymd(1969, 5, 4).and_hms(0, 0, 0);
+ let d2 = NaiveDate::from_ymd(1969, 5, 18).and_hms(0, 0, 0);
let (start, end, _) = parse("this pay period", Some(config)).unwrap();
assert_eq!(d1, start);
assert_eq!(d2, end);
@@ -534,14 +535,14 @@ fn this_pay_period_weird() {
#[test]
fn next_pay_period_weird() {
- let now = Utc.ymd(1969, 5, 6).and_hms(0, 0, 0);
+ let now = NaiveDate::from_ymd(1969, 5, 6).and_hms(0, 0, 0);
// two-week pay period beginning about a year *after* "now" on a Sunday
let config = Config::new()
- .pay_period_start(Some(Utc.ymd(1970, 4, 5)))
+ .pay_period_start(Some(NaiveDate::from_ymd(1970, 4, 5)))
.pay_period_length(14)
.now(now);
- let d1 = Utc.ymd(1969, 5, 18).and_hms(0, 0, 0);
- let d2 = Utc.ymd(1969, 6, 1).and_hms(0, 0, 0);
+ let d1 = NaiveDate::from_ymd(1969, 5, 18).and_hms(0, 0, 0);
+ let d2 = NaiveDate::from_ymd(1969, 6, 1).and_hms(0, 0, 0);
let (start, end, _) = parse("next pay period", Some(config)).unwrap();
assert_eq!(d1, start);
assert_eq!(d2, end);
@@ -549,14 +550,14 @@ fn next_pay_period_weird() {
#[test]
fn last_pay_period_weird() {
- let now = Utc.ymd(1969, 5, 6).and_hms(0, 0, 0);
+ let now = NaiveDate::from_ymd(1969, 5, 6).and_hms(0, 0, 0);
// two-week pay period beginning about a year *after* "now" on a Sunday
let config = Config::new()
- .pay_period_start(Some(Utc.ymd(1970, 4, 5)))
+ .pay_period_start(Some(NaiveDate::from_ymd(1970, 4, 5)))
.pay_period_length(14)
.now(now);
- let d1 = Utc.ymd(1969, 4, 20).and_hms(0, 0, 0);
- let d2 = Utc.ymd(1969, 5, 4).and_hms(0, 0, 0);
+ let d1 = NaiveDate::from_ymd(1969, 4, 20).and_hms(0, 0, 0);
+ let d2 = NaiveDate::from_ymd(1969, 5, 4).and_hms(0, 0, 0);
let (start, end, _) = parse("last pay period", Some(config)).unwrap();
assert_eq!(d1, start);
assert_eq!(d2, end);
@@ -564,9 +565,9 @@ fn last_pay_period_weird() {
#[test]
fn this_april() {
- let now = Utc.ymd(1969, 5, 6).and_hms(0, 0, 0);
- let d1 = Utc.ymd(1969, 4, 1).and_hms(0, 0, 0);
- let d2 = Utc.ymd(1969, 5, 1).and_hms(0, 0, 0);
+ let now = NaiveDate::from_ymd(1969, 5, 6).and_hms(0, 0, 0);
+ let d1 = NaiveDate::from_ymd(1969, 4, 1).and_hms(0, 0, 0);
+ let d2 = NaiveDate::from_ymd(1969, 5, 1).and_hms(0, 0, 0);
let (start, end, _) = parse("this april", Some(Config::new().now(now))).unwrap();
assert_eq!(d1, start);
assert_eq!(d2, end);
@@ -574,9 +575,9 @@ fn this_april() {
#[test]
fn next_april() {
- let now = Utc.ymd(1969, 5, 6).and_hms(0, 0, 0);
- let d1 = Utc.ymd(1970, 4, 1).and_hms(0, 0, 0);
- let d2 = Utc.ymd(1970, 5, 1).and_hms(0, 0, 0);
+ let now = NaiveDate::from_ymd(1969, 5, 6).and_hms(0, 0, 0);
+ let d1 = NaiveDate::from_ymd(1970, 4, 1).and_hms(0, 0, 0);
+ let d2 = NaiveDate::from_ymd(1970, 5, 1).and_hms(0, 0, 0);
let (start, end, _) = parse("next april", Some(Config::new().now(now))).unwrap();
assert_eq!(d1, start);
assert_eq!(d2, end);
@@ -584,9 +585,9 @@ fn next_april() {
#[test]
fn last_april() {
- let now = Utc.ymd(1969, 5, 6).and_hms(0, 0, 0);
- let d1 = Utc.ymd(1968, 4, 1).and_hms(0, 0, 0);
- let d2 = Utc.ymd(1968, 5, 1).and_hms(0, 0, 0);
+ let now = NaiveDate::from_ymd(1969, 5, 6).and_hms(0, 0, 0);
+ let d1 = NaiveDate::from_ymd(1968, 4, 1).and_hms(0, 0, 0);
+ let d2 = NaiveDate::from_ymd(1968, 5, 1).and_hms(0, 0, 0);
let (start, end, _) = parse("last april", Some(Config::new().now(now))).unwrap();
assert_eq!(d1, start);
assert_eq!(d2, end);
@@ -594,9 +595,9 @@ fn last_april() {
#[test]
fn this_friday() {
- let now = Utc.ymd(1969, 5, 6).and_hms(0, 0, 0);
- let d1 = Utc.ymd(1969, 5, 9).and_hms(0, 0, 0);
- let d2 = Utc.ymd(1969, 5, 10).and_hms(0, 0, 0);
+ let now = NaiveDate::from_ymd(1969, 5, 6).and_hms(0, 0, 0);
+ let d1 = NaiveDate::from_ymd(1969, 5, 9).and_hms(0, 0, 0);
+ let d2 = NaiveDate::from_ymd(1969, 5, 10).and_hms(0, 0, 0);
let (start, end, _) = parse("this friday", Some(Config::new().now(now))).unwrap();
assert_eq!(d1, start);
assert_eq!(d2, end);
@@ -604,9 +605,9 @@ fn this_friday() {
#[test]
fn next_friday() {
- let now = Utc.ymd(1969, 5, 6).and_hms(0, 0, 0);
- let d1 = Utc.ymd(1969, 5, 16).and_hms(0, 0, 0);
- let d2 = Utc.ymd(1969, 5, 17).and_hms(0, 0, 0);
+ let now = NaiveDate::from_ymd(1969, 5, 6).and_hms(0, 0, 0);
+ let d1 = NaiveDate::from_ymd(1969, 5, 16).and_hms(0, 0, 0);
+ let d2 = NaiveDate::from_ymd(1969, 5, 17).and_hms(0, 0, 0);
let (start, end, _) = parse("next friday", Some(Config::new().now(now))).unwrap();
assert_eq!(d1, start);
assert_eq!(d2, end);
@@ -614,9 +615,9 @@ fn next_friday() {
#[test]
fn last_friday() {
- let now = Utc.ymd(1969, 5, 6).and_hms(0, 0, 0);
- let d1 = Utc.ymd(1969, 5, 2).and_hms(0, 0, 0);
- let d2 = Utc.ymd(1969, 5, 3).and_hms(0, 0, 0);
+ let now = NaiveDate::from_ymd(1969, 5, 6).and_hms(0, 0, 0);
+ let d1 = NaiveDate::from_ymd(1969, 5, 2).and_hms(0, 0, 0);
+ let d2 = NaiveDate::from_ymd(1969, 5, 3).and_hms(0, 0, 0);
let (start, end, _) = parse("last friday", Some(Config::new().now(now))).unwrap();
assert_eq!(d1, start);
assert_eq!(d2, end);
@@ -624,9 +625,9 @@ fn last_friday() {
#[test]
fn this_monday() {
- let now = Utc.ymd(1969, 5, 6).and_hms(0, 0, 0);
- let d1 = Utc.ymd(1969, 5, 5).and_hms(0, 0, 0);
- let d2 = Utc.ymd(1969, 5, 6).and_hms(0, 0, 0);
+ let now = NaiveDate::from_ymd(1969, 5, 6).and_hms(0, 0, 0);
+ let d1 = NaiveDate::from_ymd(1969, 5, 5).and_hms(0, 0, 0);
+ let d2 = NaiveDate::from_ymd(1969, 5, 6).and_hms(0, 0, 0);
let (start, end, _) = parse("this monday", Some(Config::new().now(now))).unwrap();
assert_eq!(d1, start);
assert_eq!(d2, end);
@@ -634,9 +635,9 @@ fn this_monday() {
#[test]
fn next_monday() {
- let now = Utc.ymd(1969, 5, 6).and_hms(0, 0, 0);
- let d1 = Utc.ymd(1969, 5, 12).and_hms(0, 0, 0);
- let d2 = Utc.ymd(1969, 5, 13).and_hms(0, 0, 0);
+ let now = NaiveDate::from_ymd(1969, 5, 6).and_hms(0, 0, 0);
+ let d1 = NaiveDate::from_ymd(1969, 5, 12).and_hms(0, 0, 0);
+ let d2 = NaiveDate::from_ymd(1969, 5, 13).and_hms(0, 0, 0);
let (start, end, _) = parse("next monday", Some(Config::new().now(now))).unwrap();
assert_eq!(d1, start);
assert_eq!(d2, end);
@@ -644,9 +645,9 @@ fn next_monday() {
#[test]
fn last_monday() {
- let now = Utc.ymd(1969, 5, 6).and_hms(0, 0, 0);
- let d1 = Utc.ymd(1969, 4, 28).and_hms(0, 0, 0);
- let d2 = Utc.ymd(1969, 4, 29).and_hms(0, 0, 0);
+ let now = NaiveDate::from_ymd(1969, 5, 6).and_hms(0, 0, 0);
+ let d1 = NaiveDate::from_ymd(1969, 4, 28).and_hms(0, 0, 0);
+ let d2 = NaiveDate::from_ymd(1969, 4, 29).and_hms(0, 0, 0);
let (start, end, _) = parse("last monday", Some(Config::new().now(now))).unwrap();
assert_eq!(d1, start);
assert_eq!(d2, end);
@@ -654,7 +655,7 @@ fn last_monday() {
#[test]
fn dawn_of_time() {
- let then = chrono::MIN_DATE.and_hms_milli(0, 0, 0, 0);
+ let then = chrono::naive::MIN_DATE.and_hms_milli(0, 0, 0, 0);
for phrase in [
"the beginning",
"the beginning of time",
@@ -676,7 +677,7 @@ fn dawn_of_time() {
#[test]
fn the_crack_of_doom() {
- let then = chrono::MAX_DATE.and_hms_milli(23, 59, 59, 999);
+ let then = chrono::naive::MAX_DATE.and_hms_milli(23, 59, 59, 999);
for phrase in [
"the end",
"the end of time",
@@ -706,8 +707,8 @@ fn the_crack_of_doom() {
#[test]
fn friday() {
- let now = Utc.ymd(1969, 5, 6).and_hms(0, 0, 0);
- let then = Utc.ymd(1969, 5, 2).and_hms(0, 0, 0);
+ let now = NaiveDate::from_ymd(1969, 5, 6).and_hms(0, 0, 0);
+ let then = NaiveDate::from_ymd(1969, 5, 2).and_hms(0, 0, 0);
let (start, end, _) = parse("Friday", Some(Config::new().now(now))).unwrap();
assert_eq!(then, start);
assert_eq!(then + Duration::days(1), end);
@@ -715,8 +716,8 @@ fn friday() {
#[test]
fn tuesday() {
- let now = Utc.ymd(1969, 5, 6).and_hms(0, 0, 0);
- let then = Utc.ymd(1969, 4, 29).and_hms(0, 0, 0);
+ let now = NaiveDate::from_ymd(1969, 5, 6).and_hms(0, 0, 0);
+ let then = NaiveDate::from_ymd(1969, 4, 29).and_hms(0, 0, 0);
let (start, end, _) = parse("Tuesday", Some(Config::new().now(now))).unwrap();
assert_eq!(then, start);
assert_eq!(then + Duration::days(1), end);
@@ -724,8 +725,8 @@ fn tuesday() {
#[test]
fn monday() {
- let now = Utc.ymd(1969, 5, 6).and_hms(0, 0, 0);
- let then = Utc.ymd(1969, 5, 5).and_hms(0, 0, 0);
+ let now = NaiveDate::from_ymd(1969, 5, 6).and_hms(0, 0, 0);
+ let then = NaiveDate::from_ymd(1969, 5, 5).and_hms(0, 0, 0);
let (start, end, _) = parse("Monday", Some(Config::new().now(now))).unwrap();
assert_eq!(then, start);
assert_eq!(then + Duration::days(1), end);
@@ -733,8 +734,8 @@ fn monday() {
#[test]
fn friday_at_3_pm() {
- let now = Utc.ymd(1969, 5, 6).and_hms(0, 0, 0);
- let then = Utc.ymd(1969, 5, 2).and_hms(15, 0, 0);
+ let now = NaiveDate::from_ymd(1969, 5, 6).and_hms(0, 0, 0);
+ let then = NaiveDate::from_ymd(1969, 5, 2).and_hms(15, 0, 0);
let (start, end, _) = parse("Friday at 3 pm", Some(Config::new().now(now))).unwrap();
assert_eq!(then, start);
assert_eq!(then + Duration::hours(1), end);
@@ -742,8 +743,8 @@ fn friday_at_3_pm() {
#[test]
fn tuesday_at_3_pm() {
- let now = Utc.ymd(1969, 5, 6).and_hms(0, 0, 0);
- let then = Utc.ymd(1969, 4, 29).and_hms(15, 0, 0);
+ let now = NaiveDate::from_ymd(1969, 5, 6).and_hms(0, 0, 0);
+ let then = NaiveDate::from_ymd(1969, 4, 29).and_hms(15, 0, 0);
let (start, end, _) = parse("Tuesday at 3 pm", Some(Config::new().now(now))).unwrap();
assert_eq!(then, start);
assert_eq!(then + Duration::hours(1), end);
@@ -751,8 +752,8 @@ fn tuesday_at_3_pm() {
#[test]
fn monday_at_3_pm() {
- let now = Utc.ymd(1969, 5, 6).and_hms(0, 0, 0);
- let then = Utc.ymd(1969, 5, 5).and_hms(15, 0, 0);
+ let now = NaiveDate::from_ymd(1969, 5, 6).and_hms(0, 0, 0);
+ let then = NaiveDate::from_ymd(1969, 5, 5).and_hms(15, 0, 0);
let (start, end, _) = parse("Monday at 3 pm", Some(Config::new().now(now))).unwrap();
assert_eq!(then, start);
assert_eq!(then + Duration::hours(1), end);
@@ -760,9 +761,9 @@ fn monday_at_3_pm() {
#[test]
fn just_may() {
- let now = Utc.ymd(1969, 5, 6).and_hms(0, 0, 0);
- let d1 = Utc.ymd(1969, 5, 1).and_hms(0, 0, 0);
- let d2 = Utc.ymd(1969, 6, 1).and_hms(0, 0, 0);
+ let now = NaiveDate::from_ymd(1969, 5, 6).and_hms(0, 0, 0);
+ let d1 = NaiveDate::from_ymd(1969, 5, 1).and_hms(0, 0, 0);
+ let d2 = NaiveDate::from_ymd(1969, 6, 1).and_hms(0, 0, 0);
let (start, end, _) = parse("May", Some(Config::new().now(now))).unwrap();
assert_eq!(d1, start);
assert_eq!(d2, end);
@@ -770,9 +771,9 @@ fn just_may() {
#[test]
fn just_april() {
- let now = Utc.ymd(1969, 5, 6).and_hms(0, 0, 0);
- let d1 = Utc.ymd(1969, 4, 1).and_hms(0, 0, 0);
- let d2 = Utc.ymd(1969, 5, 1).and_hms(0, 0, 0);
+ let now = NaiveDate::from_ymd(1969, 5, 6).and_hms(0, 0, 0);
+ let d1 = NaiveDate::from_ymd(1969, 4, 1).and_hms(0, 0, 0);
+ let d2 = NaiveDate::from_ymd(1969, 5, 1).and_hms(0, 0, 0);
let (start, end, _) = parse("April", Some(Config::new().now(now))).unwrap();
assert_eq!(d1, start);
assert_eq!(d2, end);
@@ -780,9 +781,9 @@ fn just_april() {
#[test]
fn just_june() {
- let now = Utc.ymd(1969, 5, 6).and_hms(0, 0, 0);
- let d1 = Utc.ymd(1968, 6, 1).and_hms(0, 0, 0);
- let d2 = Utc.ymd(1968, 7, 1).and_hms(0, 0, 0);
+ let now = NaiveDate::from_ymd(1969, 5, 6).and_hms(0, 0, 0);
+ let d1 = NaiveDate::from_ymd(1968, 6, 1).and_hms(0, 0, 0);
+ let d2 = NaiveDate::from_ymd(1968, 7, 1).and_hms(0, 0, 0);
let (start, end, _) = parse("June", Some(Config::new().now(now))).unwrap();
assert_eq!(d1, start);
assert_eq!(d2, end);
@@ -790,9 +791,9 @@ fn just_june() {
#[test]
fn monday_through_friday() {
- let now = Utc.ymd(1969, 5, 6).and_hms(0, 0, 0);
- let d1 = Utc.ymd(1969, 5, 5).and_hms(0, 0, 0);
- let d2 = Utc.ymd(1969, 5, 10).and_hms(0, 0, 0);
+ let now = NaiveDate::from_ymd(1969, 5, 6).and_hms(0, 0, 0);
+ let d1 = NaiveDate::from_ymd(1969, 5, 5).and_hms(0, 0, 0);
+ let d2 = NaiveDate::from_ymd(1969, 5, 10).and_hms(0, 0, 0);
let (start, end, _) = parse("Monday through Friday", Some(Config::new().now(now))).unwrap();
assert_eq!(d1, start);
assert_eq!(d2, end);
@@ -800,9 +801,9 @@ fn monday_through_friday() {
#[test]
fn tuesday_through_friday() {
- let now = Utc.ymd(1969, 5, 6).and_hms(0, 0, 0);
- let d1 = Utc.ymd(1969, 4, 29).and_hms(0, 0, 0);
- let d2 = Utc.ymd(1969, 5, 3).and_hms(0, 0, 0);
+ let now = NaiveDate::from_ymd(1969, 5, 6).and_hms(0, 0, 0);
+ let d1 = NaiveDate::from_ymd(1969, 4, 29).and_hms(0, 0, 0);
+ let d2 = NaiveDate::from_ymd(1969, 5, 3).and_hms(0, 0, 0);
let (start, end, _) = parse("Tuesday through Friday", Some(Config::new().now(now))).unwrap();
assert_eq!(d1, start);
assert_eq!(d2, end);
@@ -810,9 +811,9 @@ fn tuesday_through_friday() {
#[test]
fn tuesday_through_3_pm_on_friday() {
- let now = Utc.ymd(1969, 5, 6).and_hms(0, 0, 0);
- let d1 = Utc.ymd(1969, 4, 29).and_hms(0, 0, 0);
- let d2 = Utc.ymd(1969, 5, 2).and_hms(15, 0, 0);
+ let now = NaiveDate::from_ymd(1969, 5, 6).and_hms(0, 0, 0);
+ let d1 = NaiveDate::from_ymd(1969, 4, 29).and_hms(0, 0, 0);
+ let d2 = NaiveDate::from_ymd(1969, 5, 2).and_hms(15, 0, 0);
let (start, end, _) = parse(
"Tuesday through 3 PM on Friday",
Some(Config::new().now(now)),
@@ -824,9 +825,9 @@ fn tuesday_through_3_pm_on_friday() {
#[test]
fn this_year_through_today() {
- let now = Utc.ymd(1969, 5, 6).and_hms(0, 0, 0);
- let d1 = Utc.ymd(1969, 1, 1).and_hms(0, 0, 0);
- let d2 = Utc.ymd(1969, 5, 7).and_hms(0, 0, 0);
+ let now = NaiveDate::from_ymd(1969, 5, 6).and_hms(0, 0, 0);
+ let d1 = NaiveDate::from_ymd(1969, 1, 1).and_hms(0, 0, 0);
+ let d2 = NaiveDate::from_ymd(1969, 5, 7).and_hms(0, 0, 0);
let (start, end, _) = parse("this year through today", Some(Config::new().now(now))).unwrap();
assert_eq!(d1, start);
assert_eq!(d2, end);
@@ -834,7 +835,7 @@ fn this_year_through_today() {
#[test]
fn april_3_25_bc() {
- let d1 = Utc.ymd(-24, 4, 3).and_hms(0, 0, 0);
+ let d1 = NaiveDate::from_ymd(-24, 4, 3).and_hms(0, 0, 0);
let d2 = d1 + Duration::days(1);
let (start, end, _) = parse("April 3, 25 BC", None).unwrap();
assert_eq!(d1, start);
@@ -843,9 +844,141 @@ fn april_3_25_bc() {
#[test]
fn april_3_25_ad() {
- let d1 = Utc.ymd(25, 4, 3).and_hms(0, 0, 0);
+ let d1 = NaiveDate::from_ymd(25, 4, 3).and_hms(0, 0, 0);
let d2 = d1 + Duration::days(1);
let (start, end, _) = parse("April 3, 25 AD", None).unwrap();
assert_eq!(d1, start);
assert_eq!(d2, end);
}
+
+#[test]
+fn this_weekend() {
+ let now = NaiveDate::from_ymd(1969, 5, 6).and_hms(0, 0, 0);
+ let d1 = NaiveDate::from_ymd(1969, 5, 10).and_hms(0, 0, 0);
+ let d2 = NaiveDate::from_ymd(1969, 5, 12).and_hms(0, 0, 0);
+ let (start, end, _) = parse("this weekend", Some(Config::new().now(now))).unwrap();
+ assert_eq!(d1, start);
+ assert_eq!(d2, end);
+}
+
+#[test]
+fn last_weekend() {
+ let now = NaiveDate::from_ymd(1969, 5, 6).and_hms(0, 0, 0);
+ let d1 = NaiveDate::from_ymd(1969, 5, 3).and_hms(0, 0, 0);
+ let d2 = NaiveDate::from_ymd(1969, 5, 5).and_hms(0, 0, 0);
+ let (start, end, _) = parse("last weekend", Some(Config::new().now(now))).unwrap();
+ assert_eq!(d1, start);
+ assert_eq!(d2, end);
+}
+
+#[test]
+fn next_weekend() {
+ let now = NaiveDate::from_ymd(1969, 5, 6).and_hms(0, 0, 0);
+ let d1 = NaiveDate::from_ymd(1969, 5, 17).and_hms(0, 0, 0);
+ let d2 = NaiveDate::from_ymd(1969, 5, 19).and_hms(0, 0, 0);
+ let (start, end, _) = parse("next weekend", Some(Config::new().now(now))).unwrap();
+ assert_eq!(d1, start);
+ assert_eq!(d2, end);
+}
+
+#[test]
+fn this_weekend_on_saturday() {
+ let now = NaiveDate::from_ymd(1969, 5, 10).and_hms(0, 0, 0);
+ let d1 = NaiveDate::from_ymd(1969, 5, 10).and_hms(0, 0, 0);
+ let d2 = NaiveDate::from_ymd(1969, 5, 12).and_hms(0, 0, 0);
+ let (start, end, _) = parse("this weekend", Some(Config::new().now(now))).unwrap();
+ assert_eq!(d1, start);
+ assert_eq!(d2, end);
+}
+
+#[test]
+fn last_weekend_on_saturday() {
+ let now = NaiveDate::from_ymd(1969, 5, 10).and_hms(0, 0, 0);
+ let d1 = NaiveDate::from_ymd(1969, 5, 3).and_hms(0, 0, 0);
+ let d2 = NaiveDate::from_ymd(1969, 5, 5).and_hms(0, 0, 0);
+ let (start, end, _) = parse("last weekend", Some(Config::new().now(now))).unwrap();
+ assert_eq!(d1, start);
+ assert_eq!(d2, end);
+}
+
+#[test]
+fn next_weekend_on_saturday() {
+ let now = NaiveDate::from_ymd(1969, 5, 10).and_hms(0, 0, 0);
+ let d1 = NaiveDate::from_ymd(1969, 5, 17).and_hms(0, 0, 0);
+ let d2 = NaiveDate::from_ymd(1969, 5, 19).and_hms(0, 0, 0);
+ let (start, end, _) = parse("next weekend", Some(Config::new().now(now))).unwrap();
+ assert_eq!(d1, start);
+ assert_eq!(d2, end);
+}
+
+#[test]
+fn this_weekend_on_sunday() {
+ let now = NaiveDate::from_ymd(1969, 5, 11).and_hms(0, 0, 0);
+ let d1 = NaiveDate::from_ymd(1969, 5, 10).and_hms(0, 0, 0);
+ let d2 = NaiveDate::from_ymd(1969, 5, 12).and_hms(0, 0, 0);
+ let (start, end, _) = parse("this weekend", Some(Config::new().now(now))).unwrap();
+ assert_eq!(d1, start);
+ assert_eq!(d2, end);
+}
+
+#[test]
+fn last_weekend_on_sunday() {
+ let now = NaiveDate::from_ymd(1969, 5, 11).and_hms(0, 0, 0);
+ let d1 = NaiveDate::from_ymd(1969, 5, 3).and_hms(0, 0, 0);
+ let d2 = NaiveDate::from_ymd(1969, 5, 5).and_hms(0, 0, 0);
+ let (start, end, _) = parse("last weekend", Some(Config::new().now(now))).unwrap();
+ assert_eq!(d1, start);
+ assert_eq!(d2, end);
+}
+
+#[test]
+fn next_weekend_on_sunday() {
+ let now = NaiveDate::from_ymd(1969, 5, 11).and_hms(0, 0, 0);
+ let d1 = NaiveDate::from_ymd(1969, 5, 17).and_hms(0, 0, 0);
+ let d2 = NaiveDate::from_ymd(1969, 5, 19).and_hms(0, 0, 0);
+ let (start, end, _) = parse("next weekend", Some(Config::new().now(now))).unwrap();
+ assert_eq!(d1, start);
+ assert_eq!(d2, end);
+}
+
+#[test]
+fn this_weekend_on_sunday_when_sunday_starts_week() {
+ let now = NaiveDate::from_ymd(1969, 5, 11).and_hms(0, 0, 0);
+ let d1 = NaiveDate::from_ymd(1969, 5, 10).and_hms(0, 0, 0);
+ let d2 = NaiveDate::from_ymd(1969, 5, 12).and_hms(0, 0, 0);
+ let (start, end, _) = parse(
+ "this weekend",
+ Some(Config::new().now(now).monday_starts_week(false)),
+ )
+ .unwrap();
+ assert_eq!(d1, start);
+ assert_eq!(d2, end);
+}
+
+#[test]
+fn last_weekend_on_sunday_when_sunday_starts_week() {
+ let now = NaiveDate::from_ymd(1969, 5, 11).and_hms(0, 0, 0);
+ let d1 = NaiveDate::from_ymd(1969, 5, 3).and_hms(0, 0, 0);
+ let d2 = NaiveDate::from_ymd(1969, 5, 5).and_hms(0, 0, 0);
+ let (start, end, _) = parse(
+ "last weekend",
+ Some(Config::new().now(now).monday_starts_week(false)),
+ )
+ .unwrap();
+ assert_eq!(d1, start);
+ assert_eq!(d2, end);
+}
+
+#[test]
+fn next_weekend_on_sunday_when_sunday_starts_week() {
+ let now = NaiveDate::from_ymd(1969, 5, 11).and_hms(0, 0, 0);
+ let d1 = NaiveDate::from_ymd(1969, 5, 17).and_hms(0, 0, 0);
+ let d2 = NaiveDate::from_ymd(1969, 5, 19).and_hms(0, 0, 0);
+ let (start, end, _) = parse(
+ "next weekend",
+ Some(Config::new().now(now).monday_starts_week(false)),
+ )
+ .unwrap();
+ assert_eq!(d1, start);
+ assert_eq!(d2, end);
+}