in reply to Detecting whether DateTime object has a time component or not?
No you can't, unless you write your own version of the module (edit: which I think is a bad idea BTW). DateTime sets default values in two different places. First in new, a validator is used, with the entries:
Then new calls _new, which setshour => { type => t('Hour'), default => 0, }, minute => { type => t('Minute'), default => 0, }, second => { type => t('Second'), default => 0, },
After that there's no difference between defining those values to 0, or not defining them from the caller.# If this method is called from somewhere other than new(), then s +ome of # these defaults may not get applied. ... $p{hour} = 0 unless exists $p{hour} +; $p{minute} = 0 unless exists $p{minut +e}; $p{second} = 0 unless exists $p{secon +d};
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Detecting whether DateTime object has a time component or not?
by perlancar (Hermit) on Jun 16, 2017 at 10:19 UTC |