Skip Menu |

This queue is for tickets about the DateTime-Format-Builder CPAN distribution.

Report information
The Basics
Id: 99545
Status: resolved
Priority: 0/
Queue: DateTime-Format-Builder

People
Owner: Nobody in particular
Requestors: ether [...] cpan.org
Cc: ribasushi [...] leporine.io
AdminCc:

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



Subject: formatter is not set on inflated values
use DateTime; use DateTime::Format::MySQL; my $dt = DateTime::Format::MySQL->parse_datetime("2014-10-15 00:00:00"); print $dt->formatter; # gives undef, not 'MySQL' Why is the formatter on the inflated DateTime not set to the formatter that was used to parse the string? Without setting this, we cannot round-trip back to the same string as we started from... which leads to great headaches e.g. in database processing.
I'm not sure this is fixable in DateTime itself. It doesn't really know what called "new". Arguably, this is something that each DT::Format class could implement, though I do wonder if this might surprise some folks.
Subject: Re: [rt.cpan.org #99545] formatter is not set on inflated values
Date: Thu, 16 Oct 2014 21:50:50 -0700
To: Dave Rolsky via RT <bug-DateTime [...] rt.cpan.org>
From: Karen Etheridge <ether [...] cpan.org>
On Thu, Oct 16, 2014 at 10:28:58PM -0400, Dave Rolsky via RT wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=99545 > > I'm not sure this is fixable in DateTime itself. It doesn't really know what called "new". Arguably, this is something that each DT::Format class could implement, though I do wonder if this might surprise some folks.
Is this something that DateTime::Format::Builder could do?
On Fri Oct 17 04:28:57 2014, DROLSKY wrote: Show quoted text
> I'm not sure this is fixable in DateTime itself. It doesn't really > know what called "new". Arguably, this is something that each > DT::Format class could implement, though I do wonder if this might > surprise some folks.
I am strongly against such change. The very expectation of round-tripping formatters is flawed - this was never part of the declared API. Automagically beginning to do so not only 'might' but 'will' surprise and upset a lot of code out there. Folks expecting this behavior should be using a ::Formatter subclass.