Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DateNode -> DateTimeOffsetNode & DateNode2 -> DateTimeNode #15297

Closed
wants to merge 1 commit into from
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ public Expression BuildOperation(in BuildExpressionContext context, ConstantExpr
}
}

public class DateNode : OperatorNode
public class DateTimeOffsetNode : OperatorNode
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you check if these don't break Audit Trail admin listing? Since these are indirectly used from DefaultAuditTrailAdminListFilterProvider.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we have a list of OperatorNode in a List that is serialized as Json then it will break.
And we (with Mike) don't remember configuring these for custom json serialization (might have missed it).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this could break anyone, I will close this then

{
public DateNode(DateTimeOffset dateTime)
public DateTimeOffsetNode(DateTimeOffset dateTime)
{
DateTime = dateTime;
}
Expand All @@ -67,9 +67,9 @@ public override string ToString()
=> $"{(string.IsNullOrEmpty(Operator) ? string.Empty : Operator)}{DateTime:o}";
}

public class DateNode2 : OperatorNode
public class DateTimeNode : OperatorNode
{
public DateNode2(DateTime dateTime)
public DateTimeNode(DateTime dateTime)
{
DateTime = dateTime;
}
Expand Down Expand Up @@ -199,7 +199,7 @@ static DateTimeParser()
// Try o, primarily for times, and fall back to local timezone.
if (DateTimeOffset.TryParseExact(dateValue, "yyyy-MM-dd'T'HH:mm:ss.FFFK", CultureInfo.InvariantCulture, DateTimeStyles.None, out var dateTimeOffset))
{
return new DateNode2(dateTimeOffset.UtcDateTime);
return new DateTimeNode(dateTimeOffset.UtcDateTime);
}
else
{
Expand All @@ -216,7 +216,7 @@ static DateTimeParser()
if (success)
{
var converted = context.Clock.ConvertToTimeZone(dateTime, context.UserTimeZone);
return new DateNode2(converted.UtcDateTime.Date);
return new DateTimeNode(converted.UtcDateTime.Date);
}
}

Expand Down
Loading