From 15c66eee5845e9330dcae25b2e11d252c7bba25f Mon Sep 17 00:00:00 2001 From: Chad Retz Date: Mon, 30 Jan 2023 08:36:39 -0600 Subject: [PATCH] Search attribute 0 timezone fix --- README.md | 3 ++- src/Temporalio/Converters/DefaultPayloadConverter.cs | 12 ++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 7447d61a..ad0fb9b8 100644 --- a/README.md +++ b/README.md @@ -112,4 +112,5 @@ TODO: * Rules for options classes * Shallow-copyable via virtual clone * Empty constructor and constructor with required params - * TODO(cretz): Validation? Probably don't want attributes? \ No newline at end of file + * TODO(cretz): Validation? Probably don't want attributes? +* Source generator for workflows \ No newline at end of file diff --git a/src/Temporalio/Converters/DefaultPayloadConverter.cs b/src/Temporalio/Converters/DefaultPayloadConverter.cs index 585b7369..b8057118 100644 --- a/src/Temporalio/Converters/DefaultPayloadConverter.cs +++ b/src/Temporalio/Converters/DefaultPayloadConverter.cs @@ -156,11 +156,23 @@ public Payload ToSearchAttributePayload(object value) // 8601 with roundtrip. We intentionally don't convert to universal or anything here // because the user can send with a date time kind of UTC or Local if they want. value = dateTimeValue.ToString("o"); + // TODO(cretz): Due to https://github.com/temporalio/temporal/issues/3864 we have to + // trim +0 timezone here. + if (((string)value).EndsWith("+00:00")) + { + value = ((string)value).Substring(0, ((string)value).Length - 6) + "Z"; + } } else if (value is DateTimeOffset dateTimeOffsetValue) { // 8601 with timezone value = dateTimeOffsetValue.ToString("o"); + // TODO(cretz): Due to https://github.com/temporalio/temporal/issues/3864 we have to + // trim +0 timezone here. + if (((string)value).EndsWith("+00:00")) + { + value = ((string)value).Substring(0, ((string)value).Length - 6) + "Z"; + } } else if (value is not IEnumerable && value is not string &&