Skip Menu |

This queue is for tickets about the Date-Manip CPAN distribution.

Report information
The Basics
Id: 127929
Status: resolved
Priority: 0/
Queue: Date-Manip

People
Owner: Nobody in particular
Requestors: paul [...] schillingconsulting.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: America/Santiago can't parse date if it is when DST starts at midnight
Date: Wed, 5 Dec 2018 14:16:03 -0600
To: bug-Date-Manip [...] rt.cpan.org
From: Paul Schilling <paul [...] schillingconsulting.com>
I believe this isn't limited just to Santiago but any TZ that has Daylight Saving Time starting at midnight and passing in just a date. If I try to parse 2018-08-12 it doesn't work, this is when Daylight Saving Time started and they jump forward 1 hour at midnight. If I add a time (after 1AM) then it does work. schilling13 5:09PM ~ > cat /etc/timezone America/Santiago schilling13 5:09PM ~ > perl -e 'use Date::Manip; print $Date::Manip::VERSION, "\n"; print &Date::Manip::ParseDate("8/12/2018 01:00:00"), "\n";' 6.75 2018081201:00:00 schilling13 5:09PM ~ > perl -e 'use Date::Manip; print $Date::Manip::VERSION, "\n"; print &Date::Manip::ParseDate("8/12/2018"), "\n";' 6.75 Shouldn't it just check if the date is valid? Not it is is within the time that doesn't exist? I could understand if I sent in 2018-08-12 00:23:00 it would fail as an invalid date/time. Thanks. -- Paul Schilling Schilling Consulting LLC paul@schillingconsulting.com schilling13 5:09PM ~ > perl -v This is perl 5, version 24, subversion 1 (v5.24.1) built for i686-linux-gnu-thread-multi-64int (with 81 registered patches, see perl -V for more detail) Copyright 1987-2017, Larry Wall Perl may be copied only under the terms of either the Artistic License or the GNU General Public License, which may be found in the Perl 5 source kit. Complete documentation for Perl, including FAQ lists, should be found on this system using "man perl" or "perldoc perl". If you have access to the Internet, point your browser at http://www.perl.org/, the Perl Home Page. schilling13 5:09PM ~ > uname -a Linux schilling13 4.9.0-6-686-pae #1 SMP Debian 4.9.82-1+deb9u3 (2018-03-02) i686 GNU/Linux
The problem is partly semantics (I'd perhaps change some of the terms used in Date::Manip if I could go back and start over). When Date::Manip says 'date', it means a specific point in time including both the date and time of day. When you parse a date, if you don't supply a time of day, it uses a default (midnight). If that time doesn't exist (as in your situation, and a very small number of others where a time change occurs at midnight), the date is invalid, and the parse_date routine records an error. I've actually been considering your situation for a few days to try and think of an easy way to resolve it, and I haven't come up with a good solution. I don't want to change Date::Manip's default time (that default is too old and too many things depend on it). As a result, the best thing that I can think of would be to set the config variable "DefaultTime" to something like 12:00:00. Then, when you parse a date, it'll use the default time of noon. No timezone makes a change at that time ever, so it should avoid the issue. Then, if you actually need to make use of the time of day, you'll have to take into account what you have set as the default. Hope this helps...