You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Mojo::Date objects stringify to RFC 7231 HTTP-date format. As a consequence sorting is kind of broken:
With string comparison operators their first sort attribute is the English week day name, and you get wrong results and warnings with numeric comparison.
Steps to reproduce the behavior
$> perl -MMojo::Date -wE 'say Mojo::Date->new("2020-10-15T00:00:00Z") cmp Mojo::Date->new("2020-10-16T00:00:00Z");'
1
$> perl -MMojo::Date -wE 'say Mojo::Date->new("2020-10-15T00:00:00Z") <=> Mojo::Date->new("2020-10-16T00:00:00Z");'
Argument "Fri, 16 Oct 2020 00:00:00 GMT" isn't numeric in numeric comparison (<=>) at -e line 1.
Argument "Thu, 15 Oct 2020 00:00:00 GMT" isn't numeric in numeric comparison (<=>) at -e line 1.
0
Mojo::Date
objects stringify to RFC 7231 HTTP-date format. As a consequence sorting is kind of broken:With string comparison operators their first sort attribute is the English week day name, and you get wrong results and warnings with numeric comparison.
Steps to reproduce the behavior
Expected behavior
Actual behavior
See Steps to reproduce the behavior
Suggested code change
Overload
cmp
and<=>
with something likesub ($l, $r) { $l->epoch <=> $r->epoch }
(type check for $r omitted for brevity).The text was updated successfully, but these errors were encountered: