| Conditions | 5 |
| Paths | 5 |
| Total Lines | 28 |
| Code Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 58 | public function parseValue($date) |
||
| 59 | { |
||
| 60 | if (empty($date)) { |
||
| 61 | return; |
||
| 62 | } |
||
| 63 | |||
| 64 | //contains in date |
||
| 65 | $this->setOperator('contains'); |
||
| 66 | |||
| 67 | if (! $date instanceof Carbon) { |
||
|
|
|||
| 68 | try { |
||
| 69 | $date = Carbon::parse($date); |
||
| 70 | } catch (\Exception $e) { |
||
| 71 | try { |
||
| 72 | $date = Carbon::createFromFormat($this->getPickerFormat(), $date); |
||
| 73 | } catch (\Exception $e) { |
||
| 74 | Log::error('Unable to parse date!', [ |
||
| 75 | 'format' => $this->getPickerFormat(), |
||
| 76 | 'date' => $date, |
||
| 77 | 'exception' => $e, |
||
| 78 | ]); |
||
| 79 | |||
| 80 | return; |
||
| 81 | } |
||
| 82 | } |
||
| 83 | } |
||
| 84 | |||
| 85 | return $date->timezone($this->getTimezone())->format($this->getFormat()); |
||
| 86 | } |
||
| 88 |