| @@ -12,8 +12,25 @@ | ||
| 12 | 12 | { |
| 13 | 13 | parent::__construct($attributes); |
| 14 | 14 | } |
| 15 | 15 | |
| 16 | + /** | |
| 17 | + * Dates go out as stored: site time, "Y-m-d H:i:s", like every other date | |
| 18 | + * column. The framework default is an ISO UTC moment, which made | |
| 19 | + * created_at/updated_at the only dates in another format. | |
| 20 | + * | |
| 21 | + * @param \DateTimeInterface $date | |
| 22 | + * @return string | |
| 23 | + */ | |
| 24 | + protected function serializeDate(\DateTimeInterface $date) | |
| 25 | + { | |
| 26 | + if ($date instanceof \DateTime || $date instanceof \DateTimeImmutable) { | |
| 27 | + $date = (clone $date)->setTimezone(wp_timezone()); | |
| 28 | + } | |
| 29 | + | |
| 30 | + return $date->format('Y-m-d H:i:s'); | |
| 31 | + } | |
| 32 | + | |
| 16 | 33 | public function getPerPage() |
| 17 | 34 | { |
| 18 | 35 | if (!isset($_REQUEST['per_page'])) { |
| 19 | 36 | return 15; |