Skip to content

Commit 4df8bd5

Browse files
Mario Mannomeain
andauthored
Apply suggestions from code review
Co-authored-by: Abin Simon <[email protected]>
1 parent 0f9d4f5 commit 4df8bd5

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

src/app.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -290,11 +290,10 @@ fn validate_date_argument(arg: String) -> Result<(), String> {
290290
}
291291

292292
pub fn validate_time_format(formatter: &str) -> Result<(), String> {
293-
let str = formatter.to_string();
294-
let vec: Vec<&str> = str.split('\n').collect();
293+
let vec: Vec<&str> = formatter.split('\n').collect();
295294

296295
if vec.len() > 2 {
297-
return Err("invalid format, can only contain one newline separator".to_owned());
296+
return Err("invalid date format, cannot contain more than two entries".to_owned());
298297
}
299298

300299
for s in vec {

src/meta/date.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ impl Date {
6868
DateFlag::Formatted(format) => {
6969
let vec: Vec<&str> = format.split('\n').collect();
7070

71-
if vec.len() == 1 || *val > Local::now() - Duration::seconds(15_778_476) {
71+
if vec.len() == 1 || *val < Local::now() - Duration::seconds(15_778_476) {
7272
// non-recent or only one format
7373
val.format(vec[0]).to_string()
7474
} else {

0 commit comments

Comments
 (0)