array_to_csv.php
3 years ago
date_format.php
3 years ago
exact_range.php
3 years ago
number_formatter.php
3 years ago
relative_range.php
3 years ago
request.php
3 years ago
salt.php
3 years ago
security.php
3 years ago
singleton.php
3 years ago
string.php
3 years ago
timezone.php
3 years ago
url.php
3 years ago
wp-async-request.php
3 years ago
exact_range.php
27 lines
| 1 | <?php |
| 2 | |
| 3 | namespace IAWP; |
| 4 | |
| 5 | class Exact_Range |
| 6 | { |
| 7 | public $label; |
| 8 | public $start; |
| 9 | public $end; |
| 10 | |
| 11 | public function __construct($start, $end) |
| 12 | { |
| 13 | $tz = Timezone::local_timezone(); |
| 14 | $this->start = new \DateTime($start, $tz); |
| 15 | $this->end = new \DateTime($end, $tz); |
| 16 | $this->label = $this->get_label(); |
| 17 | } |
| 18 | |
| 19 | private function get_label() |
| 20 | { |
| 21 | $formatted_start = $this->start->format(Date_Format::php()); |
| 22 | $formatted_end = $this->end->format(Date_Format::php()); |
| 23 | |
| 24 | return $formatted_start . ' - ' . $formatted_end; |
| 25 | } |
| 26 | } |
| 27 |