diff --git a/dotnet/src/dotnetframework/GxClasses/Core/GXUtilsCommon.cs b/dotnet/src/dotnetframework/GxClasses/Core/GXUtilsCommon.cs index 1cc07c9fe..7aa5dc2bb 100644 --- a/dotnet/src/dotnetframework/GxClasses/Core/GXUtilsCommon.cs +++ b/dotnet/src/dotnetframework/GxClasses/Core/GXUtilsCommon.cs @@ -2297,6 +2297,20 @@ static string FormatEmptyDate(string pic) } return emptyDT.ToString(); } + static string FormatEmptyJsonDate(string pic) + { + StringBuilder emptyDT = new StringBuilder(pic); + emptyDT.Replace('d', '0'); + emptyDT.Replace('M', '0'); + emptyDT.Replace('y', '0'); + + emptyDT.Replace('m', '0'); + emptyDT.Replace('s', '0'); + emptyDT.Replace('f', '0'); + emptyDT.Replace('h', '0'); + emptyDT.Replace('H', '0'); + return emptyDT.ToString(); + } string TimeFormatFromSDT(String S, String TSep, bool allowsOneDigitTime) { int pos1, pos2, pos3, tSize, ampmFmt; @@ -2551,6 +2565,13 @@ public static string DToC2(DateTime dt) else return dt.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture); } + internal static string DToC2(DateTime dt, string format) + { + if (dt == nullDate) + return FormatEmptyJsonDate(format); + else + return dt.ToString(format, CultureInfo.InvariantCulture); + } public static DateTime CToD2(string value) { if (isNullJsonDate(value)) diff --git a/dotnet/src/dotnetframework/GxClasses/Services/GxRestWrapper.cs b/dotnet/src/dotnetframework/GxClasses/Services/GxRestWrapper.cs index 294e876fa..714da4d4e 100644 --- a/dotnet/src/dotnetframework/GxClasses/Services/GxRestWrapper.cs +++ b/dotnet/src/dotnetframework/GxClasses/Services/GxRestWrapper.cs @@ -745,13 +745,7 @@ protected Task Serialize(Dictionary parameters, Dictionary parameters, Dictionary parameters, Dictionary fmtParameters) + { + DateTime udt = (dt==DateTimeUtil.NullDate()) ? dt: dt.ToUniversalTime(); + + if (fmtParameters.ContainsKey(key) && !String.IsNullOrEmpty(fmtParameters[key])) + { + return DateTimeUtil.DToC2(udt, fmtParameters[key]); + } + return udt; + } + private bool PrimitiveType(Type type) { return type.IsPrimitive || type == typeof(string) || type.IsValueType;