FF-1680: New flow elements for file/folder dates

This commit is contained in:
John Andrews
2024-07-21 15:57:16 +12:00
parent 7e13545972
commit 28513001da
11 changed files with 89 additions and 15 deletions

View File

@@ -138,12 +138,15 @@ public class DirectoryDateCompare : Node
}
// then it must be a between or not between
var minutes = now.Subtract(date).TotalMinutes;
int low = Math.Min(DateComparision.Value1, DateComparision.Value2);
int high = Math.Max(DateComparision.Value1, DateComparision.Value2);
bool isBetween = minutes >= low && minutes <= high;
int high = Math.Max(DateComparision.Value1, DateComparision.Value2);
DateTime lowDate = now.AddMinutes(-low);
DateTime highDate = now.AddMinutes(-high);
bool isBetween = now >= lowDate && now <= highDate;
args.Logger?.ILog(
$"Date is {(isBetween ? "" : "not ")}between {low} minutes and {high} minutes");
$"Date is {(isBetween ? "" : "not ")}between {lowDate:yyyy-MM-ddTHH:mm:ss}Z and {highDate:yyyy-MM-ddTHH:mm:ss}Z");
if (DateComparision.Comparison is DateCompareMode.Between)
{

View File

@@ -134,12 +134,15 @@ public class FileDateCompare : Node
}
// then it must be a between or not between
var minutes = now.Subtract(date).TotalMinutes;
int low = Math.Min(DateComparision.Value1, DateComparision.Value2);
int high = Math.Max(DateComparision.Value1, DateComparision.Value2);
bool isBetween = minutes >= low && minutes <= high;
int high = Math.Max(DateComparision.Value1, DateComparision.Value2);
DateTime lowDate = now.AddMinutes(-low);
DateTime highDate = now.AddMinutes(-high);
bool isBetween = now >= lowDate && now <= highDate;
args.Logger?.ILog(
$"Date is {(isBetween ? "" : "not ")}between {low} minutes and {high} minutes");
$"Date is {(isBetween ? "" : "not ")}between {lowDate:yyyy-MM-ddTHH:mm:ss}Z and {highDate:yyyy-MM-ddTHH:mm:ss}Z");
if (DateComparision.Comparison is DateCompareMode.Between)
{

View File

@@ -90,7 +90,7 @@
},
"Fields": {
"Path": "Path",
"Path-Help": "The path to the file to check. Leave empty to check the current working file.\nIf a file is specified the directory containing the file will be checked.",
"Path-Help": "The path to the folder to check. Leave empty to check the current working file.\nIf a file is specified the directory containing the file will be checked.",
"Date": "Date",
"DateComparision": "Comparision"
}