fu/t/httpdate.t
Yorhel fbbaa23842 pg: Add date type & httpdate tests
...I was hoping not to have to implement the date type, because date
conversions suck, but it turns out manned.org actually needs it.
(Only to then convert it into a Unix timestamp again, hmm, maybe this
string conversion isn't useful at all?)
2025-02-24 11:54:37 +01:00

13 lines
451 B
Perl

use v5.38;
use Test::More;
use FU::Util 'httpdate_format', 'httpdate_parse';
is httpdate_format(0), 'Thu, 01 Jan 1970 00:00:00 GMT';
is httpdate_format(1740325942), 'Sun, 23 Feb 2025 15:52:22 GMT';
is httpdate_parse('Thu, 01 Jan 1970 00:00:00 GMT'), 0;
is httpdate_parse('Sun, 23 Feb 2025 15:52:22 GMT'), 1740325942;
is httpdate_parse('Sub, 23 Feb 2025 15:52:22 GMT'), undef;
is httpdate_parse('Sun, 3 Feb 2025 15:52:22 GMT'), undef;
done_testing;