Skip to content

Commit

Permalink
Remove support for old version (per-8.4) of postgresql
Browse files Browse the repository at this point in the history
The _fix_timezone sub had a workaround for a bug in postgresql's
handling of pre-1901 an post-2038 dates. This is no longer needed.
The bug was fixed in pg 8.4. The fix is to remove the work around
and the corresponding test. As we get closer to 2038 this will
become more apparent.
  • Loading branch information
yewtc committed Apr 18, 2023
1 parent 687f04c commit cab4ff5
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 44 deletions.
20 changes: 0 additions & 20 deletions lib/DateTime/Format/Pg.pm
Original file line number Diff line number Diff line change
Expand Up @@ -340,26 +340,6 @@ sub _fix_timezone {
$args{'parsed'}->{'time_zone'} = $param{'_force_tz'};
}

elsif(!defined($args{'parsed'}->{'time_zone'})) {
# For very early and late dates, PostgreSQL always returns times in
# UTC and does not tell us that it did so.
#
if ( $args{'parsed'}->{'year'} < 1901
|| ( $args{'parsed'}->{'year'} == 1901 && ($args{'parsed'}->{'month'} < 12 || $args{'parsed'}->{'day'} < 14) )
|| $args{'parsed'}->{'year'} > 2038
|| ( $args{'parsed'}->{'year'} == 2038 && ($args{'parsed'}->{'month'} > 01 || $args{'parsed'}->{'day'} > 18) )
) {
$args{'parsed'}->{'time_zone'} = DateTime::TimeZone::UTC->new();
}

# DT->new() does not like undef time_zone params, which are generated
# by the regexps
#
else {
delete $args{'parsed'}->{'time_zone'};
}
}

# Numerical time zone
#

Expand Down
24 changes: 0 additions & 24 deletions t/tz_1901_2038.t

This file was deleted.

0 comments on commit cab4ff5

Please sign in to comment.