Re-export the chrono crate from taskchampion.

The chrono types are central to use of TC, so this will help consumers
of the TC crate to avoid dependency conflicts.
This commit is contained in:
Dustin J. Mitchell
2022-03-12 20:12:39 +00:00
parent 9355e1a728
commit f8c4ece238
17 changed files with 23 additions and 24 deletions

View File

@@ -1,8 +1,8 @@
use super::{any, timestamp};
use crate::argparse::NOW;
use chrono::prelude::*;
use nom::bytes::complete::tag as nomtag;
use nom::{branch::*, character::complete::*, combinator::*, sequence::*, IResult};
use taskchampion::chrono::prelude::*;
use taskchampion::Status;
/// Recognizes up to the colon of the common `<prefix>:...` syntax
@@ -52,6 +52,7 @@ pub(crate) fn wait_colon(input: &str) -> IResult<&str, Option<DateTime<Utc>>> {
mod test {
use super::*;
use pretty_assertions::assert_eq;
use taskchampion::chrono::Duration;
#[test]
fn test_colon_prefix() {
@@ -77,10 +78,10 @@ mod test {
fn test_wait() {
assert_eq!(wait_colon("wait:").unwrap(), ("", None));
let one_day = *NOW + chrono::Duration::days(1);
let one_day = *NOW + Duration::days(1);
assert_eq!(wait_colon("wait:1d").unwrap(), ("", Some(one_day)));
let one_day = *NOW + chrono::Duration::days(1);
let one_day = *NOW + Duration::days(1);
assert_eq!(wait_colon("wait:1d2").unwrap(), ("2", Some(one_day)));
}
}

View File

@@ -1,4 +1,3 @@
use chrono::{prelude::*, Duration};
use iso8601_duration::Duration as IsoDuration;
use lazy_static::lazy_static;
use nom::{
@@ -13,6 +12,7 @@ use nom::{
Err, IResult,
};
use std::str::FromStr;
use taskchampion::chrono::{self, prelude::*, Duration};
// https://taskwarrior.org/docs/dates.html
// https://taskwarrior.org/docs/named_dates.html