Skip to content

Commit

Permalink
Search attribute 0 timezone fix
Browse files Browse the repository at this point in the history
  • Loading branch information
cretz committed Jan 30, 2023
1 parent 4f02102 commit 4db827c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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?
* TODO(cretz): Validation? Probably don't want attributes?
* Source generator for workflows
12 changes: 12 additions & 0 deletions src/Temporalio/Converters/DefaultPayloadConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
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);
}
}
else if (value is not IEnumerable<string> &&
value is not string &&
Expand Down

0 comments on commit 4db827c

Please sign in to comment.