[wp-trac] [WordPress Trac] #30845: the number of weeks in a given year

WordPress Trac noreply at wordpress.org
Fri Dec 26 08:09:46 UTC 2014


#30845: the number of weeks in a given year
-----------------------------+-----------------------------
 Reporter:  luciole135       |      Owner:
     Type:  feature request  |     Status:  new
 Priority:  normal           |  Milestone:  Awaiting Review
Component:  Date/Time        |    Version:  4.1
 Severity:  normal           |   Keywords:
  Focuses:                   |
-----------------------------+-----------------------------
 Firstly my apologies if I'm wrong place.
 I propose a correction of the function validate_date_values ($date_query =
 array()) of the /wp-includes/date.php file
 the following 341 to 343 lines:
 $date = new DateTime();
 $date-> setISODate ($date_query ['year'], 53);
 $week_count = $date-> format ('W') = '53'? 53: 52;

 may be replaced by a single line (without using the class dateTime):
 $week_count = date ('W', mktime (0,0,0,12,28,$date_query ['year']));

 Indeed, the number of weeks in a given year is equal to the corresponding
 week number of 28 December.
 http://en.Wikipedia.org/wiki/ISO_week_date

--
Ticket URL: <https://core.trac.wordpress.org/ticket/30845>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list