Problem/Motivation

Core doesn't provide us with something to replace the date_week() function with.

Proposed resolution

Move it to CalendarHelper, fix the casing of the function name, fix the docblock.

Remaining tasks

Do it.

User interface changes

None.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Anonymous’s picture

pjonckiere created an issue. See original summary.

sdstyles’s picture

Status: Active » Needs review
FileSize
5.32 KB
geertvd’s picture

Status: Needs review » Needs work

Looks good. Some small points though:

  1. +++ b/calendar.module
    @@ -234,58 +234,3 @@ function calendar_granularity_path(ViewExecutable &$view, $granularity) {
    -function date_week($date) {
    

    let's make that public static

  2. +++ b/calendar.module
    @@ -234,58 +234,3 @@ function calendar_granularity_path(ViewExecutable &$view, $granularity) {
    -  $timezone = new DateTimeZone('UTC');
    -  $date = new DateTime($date . ' 12:00:00', $timezone);
    ...
    -  $year_date = new DateTime($parts[0] . '-01-01 12:00:00', $timezone);
    

    The DateTime and DateTimeZone classes are not available in this namespace, let's use \DateTime and \DateTimeZone.

sdstyles’s picture

Status: Needs work » Needs review
FileSize
5.52 KB

Fixed, thanks.

  • geertvd committed c7cfa94 on 8.x-1.x authored by sdstyles
    Issue #2600454 by sdstyles: Move date_week() function to CalendarHelper
    
geertvd’s picture

Status: Needs review » Fixed

Looks great, thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.