You've already forked parse_datetime
mirror of
https://github.com/uutils/parse_datetime.git
synced 2026-06-10 16:13:15 -07:00
refactor: put the epoch and timezone module into separate files
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
// For the full copyright and license information, please view the LICENSE
|
||||
// file that was distributed with this source code.
|
||||
|
||||
use winnow::{combinator::preceded, ModalResult, Parser};
|
||||
|
||||
use super::primitive::{dec_int, s};
|
||||
|
||||
pub fn parse(input: &mut &str) -> ModalResult<i32> {
|
||||
s(preceded("@", dec_int)).parse_next(input)
|
||||
}
|
||||
+3
-23
@@ -29,35 +29,15 @@
|
||||
#![allow(deprecated)]
|
||||
mod combined;
|
||||
mod date;
|
||||
mod epoch;
|
||||
mod ordinal;
|
||||
mod primitive;
|
||||
mod relative;
|
||||
mod time;
|
||||
mod timezone;
|
||||
mod weekday;
|
||||
|
||||
mod epoch {
|
||||
use winnow::{combinator::preceded, ModalResult, Parser};
|
||||
|
||||
use super::primitive::{dec_int, s};
|
||||
|
||||
pub fn parse(input: &mut &str) -> ModalResult<i32> {
|
||||
s(preceded("@", dec_int)).parse_next(input)
|
||||
}
|
||||
}
|
||||
|
||||
mod timezone {
|
||||
use winnow::ModalResult;
|
||||
|
||||
use super::time;
|
||||
|
||||
pub(crate) fn parse(input: &mut &str) -> ModalResult<time::Offset> {
|
||||
time::timezone(input)
|
||||
}
|
||||
}
|
||||
|
||||
use chrono::NaiveDate;
|
||||
use chrono::{DateTime, Datelike, FixedOffset, TimeZone, Timelike};
|
||||
|
||||
use chrono::{DateTime, Datelike, FixedOffset, NaiveDate, TimeZone, Timelike};
|
||||
use primitive::space;
|
||||
use winnow::{
|
||||
combinator::{alt, trace},
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
// For the full copyright and license information, please view the LICENSE
|
||||
// file that was distributed with this source code.
|
||||
|
||||
use winnow::ModalResult;
|
||||
|
||||
use super::time;
|
||||
|
||||
pub(crate) fn parse(input: &mut &str) -> ModalResult<time::Offset> {
|
||||
time::timezone(input)
|
||||
}
|
||||
Reference in New Issue
Block a user