Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the DateTime CPAN distribution.

Report information
The Basics
Id: 46947
Status: resolved
Priority: 0/
Queue: DateTime

People
Owner: Nobody in particular
Requestors: ddascalescu+perl [...] gmail.com
Cc:
AdminCc:

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



Subject: More user-friendly error message than "parameter not listed in the validation options"
Running the code my `$date2 = $date1->subtract(day => 1)`, will produce the error below: "The following parameter was passed in the call to DateTime::Duration::new but was not listed in the validation options: day" Huh? It actually took me a while to realize the typo ("days" instead of "day") because the error message hinted at 'DateTime::Duration::new" being called, which was not readily apparent. Plus, what are the "validation options"? Couldn't find anything about that on (anno)CPAN. Would be nicer to get an error message like: 'day' is not a valid parameter for ->subtract
I've looked at this several times over the years and I've come to the conclusion that there's no good way to do this. CLDR just uses random letters as formats, so there's no good way to allow method names in the format. It's not that terrible to write: $dt->format_cldr('MMM') . $dt->method
On Fri Nov 16 12:38:31 2012, DROLSKY wrote: Show quoted text
> I've looked at this several times over the years and I've come to the > conclusion that there's no good way to do this. CLDR just uses random > letters as formats, so there's no good way to allow method names in the > format. > > It's not that terrible to write: > > $dt->format_cldr('MMM') . $dt->method
Doh, wrong ticket.