Ver código fonte

bin/taud: check if due timestamp is not less than current timestamp

ghassmo 4 anos atrás
pai
commit
fbbcb1842b
1 arquivos alterados com 6 adições e 0 exclusões
  1. 6 0
      bin/taud/src/task_info.rs

+ 6 - 0
bin/taud/src/task_info.rs

@@ -81,6 +81,12 @@ impl TaskInfo {
 
 
         let id: u32 = find_free_id(&task_ids);
         let id: u32 = find_free_id(&task_ids);
 
 
+        if let Some(d) = &due {
+            if *d < get_current_time() {
+                return Err(TaudError::InvalidDueTime)
+            }
+        }
+
         Ok(Self {
         Ok(Self {
             ref_id,
             ref_id,
             id,
             id,