daily pastebin goal
34%
SHARE
TWEET

Untitled

a guest Feb 14th, 2018 53 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. private function getDateRanges($dates){
  2.     $date_ranges = [];
  3.     $date = array_shift($dates);
  4.     $date_range['start'] = $date;
  5.     $start_date_period = $this->getPeriod($date);
  6.     $last_date = $date;
  7.     foreach ($dates as $date) {
  8.       $period = $this->getPeriod($date);
  9.       //new period
  10.       if($period != $start_date_period){
  11.         $date_range['end'] = $last_date;
  12.         $date_ranges[] = $date_range;
  13.         $date_range = ['start' => $date];
  14.         $start_date_period = $period;
  15.       }
  16.       $last_date = $date;
  17.     }
  18.     $date_range['end'] = $date;
  19.     $date_ranges[] = $date_range;
  20.     return $date_ranges;
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top