Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions dotnet/src/dotnetframework/GxClasses/Core/GXUtilsCommon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2640,13 +2640,13 @@ public string Time()

static public DateTime AddMth(DateTime dt, int cantMonths)
{
if (dt == nullDate && cantMonths < 0)
if (dt == nullDate && (cantMonths < 0 || Preferences.IgnoreAddOnEmptyDates))
return nullDate;
return dt.AddMonths(cantMonths);
}
static public DateTime AddYr(DateTime dt, int cantYears)
{
if (dt == nullDate && cantYears < 0)
if (dt == nullDate && (cantYears < 0 || Preferences.IgnoreAddOnEmptyDates))
return nullDate;
return dt.AddYears(cantYears);
}
Expand Down Expand Up @@ -2701,13 +2701,13 @@ static public int DDiff(DateTime dtMinu, DateTime dtSust)
}
static public DateTime TAdd(DateTime dt, int seconds)
{
if (dt == nullDate && seconds < 0)
if (dt == nullDate && (seconds < 0 || Preferences.IgnoreAddOnEmptyDates))
return nullDate;
return dt.AddSeconds(seconds);
}
static public DateTime TAddMs(DateTime dt, double seconds)
{
if (dt == nullDate && seconds < 0)
if (dt == nullDate && (seconds < 0 || Preferences.IgnoreAddOnEmptyDates))
return nullDate;
if (seconds % 1 == 0)
return dt.AddSeconds((int)seconds);
Expand All @@ -2716,7 +2716,7 @@ static public DateTime TAddMs(DateTime dt, double seconds)
}
static public DateTime DAdd(DateTime dt, int days)
{
if (dt == nullDate && days < 0)
if (dt == nullDate && (days < 0 || Preferences.IgnoreAddOnEmptyDates))
return nullDate;
return dt.AddDays(days);
}
Expand Down
23 changes: 23 additions & 0 deletions dotnet/src/dotnetframework/GxClasses/Core/gxconfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -727,6 +727,7 @@ public class Preferences
static string blobPath;
static string blobPathFolderName;
static int blankEmptyDates = -1;
static int ignoreAddOnEmptyDate = -1;
static int setupDB = -1;
static HTMLDocType docType = HTMLDocType.UNDEFINED;
static int docTypeDTD = -1;
Expand Down Expand Up @@ -898,7 +899,29 @@ public static bool Remote
}

}
public static bool IgnoreAddOnEmptyDates
{
get
{
if (ignoreAddOnEmptyDate == -1)
{
string val;
if (Config.GetValueOf("IGNORE_ADD_ON_EMPTY_DATE", out val) && val == "1")
{
ignoreAddOnEmptyDate = 1;
return true;
}
else
{
ignoreAddOnEmptyDate = 0;
return false;
}
}
else return (ignoreAddOnEmptyDate == 1);
}

}

public static bool BlankEmptyDates
{
get
Expand Down