[Koha-bugs] [Bug 17656] Irregularities in serial prediction pattern are planned only for current subscription
bugzilla-daemon at bugs.koha-community.org
bugzilla-daemon at bugs.koha-community.org
Fri May 15 09:55:59 CEST 2020
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17656
--- Comment #137 from Marcel de Rooy <m.de.rooy at rijksmuseum.nl> ---
You add a routine to DateUtils called issue_number:
+my $week_number = issue_number('2017-01-01', 'week');
What you actually want is a day-of-week, week number or month.
The name is confusing. I do not expect an issue_number in DateUtils.
The POD is wrong since you expect a dt and raise an exception on a string.
+ return Day_of_Week(split /-/, $date->ymd);
Please consider using a DateTime function here:
$dt->day_of_week()
$dt->wday() and $dt->dow().
$dt->local_day_of_week()
Actually $dt->dow is shorter than issue_number($dt, 'week')
+ return $date->month;
In this case it is more work to call issue_number($dt, 'month') than to say
$dt->month.
+ my $dow = issue_number( dt_from_string($date), $frequency->unit );
This is a bit confusing. If we do not know the unit, how could we save it into
dow (day of week) ? Rename ?
I recommend to remove issue_number from DateUtils. We could move it to Serials?
It is a thin wrapper to three DateTime methods. If you want to keep it in
DateUtils, we should come up with a convincing name.
--
You are receiving this mail because:
You are watching all bug changes.
More information about the Koha-bugs
mailing list