| @@ 145-162 (lines=18) @@ | ||
| 142 | * |
|
| 143 | * @return string |
|
| 144 | */ |
|
| 145 | public function parseValue($date) |
|
| 146 | { |
|
| 147 | if (empty($date)) { |
|
| 148 | return; |
|
| 149 | } |
|
| 150 | ||
| 151 | try { |
|
| 152 | $date = Carbon::parse($date); |
|
| 153 | } catch (Exception $e) { |
|
| 154 | try { |
|
| 155 | $date = Carbon::createFromFormat($this->getPickerFormat(), $date); |
|
| 156 | } catch (Exception $e) { |
|
| 157 | return; |
|
| 158 | } |
|
| 159 | } |
|
| 160 | ||
| 161 | return $date->format($this->getFormat()); |
|
| 162 | } |
|
| 163 | } |
|
| 164 | ||
| @@ 129-142 (lines=14) @@ | ||
| 126 | * |
|
| 127 | * @return string|void |
|
| 128 | */ |
|
| 129 | protected function parseValue($value) |
|
| 130 | { |
|
| 131 | try { |
|
| 132 | $time = Carbon::parse($value); |
|
| 133 | } catch (Exception $e) { |
|
| 134 | try { |
|
| 135 | $time = Carbon::createFromFormat($this->getPickerFormat(), $value); |
|
| 136 | } catch (Exception $e) { |
|
| 137 | return; |
|
| 138 | } |
|
| 139 | } |
|
| 140 | ||
| 141 | return $time->format( |
|
| 142 | $this->getPickerFormat() |
|
| 143 | ); |
|
| 144 | } |
|
| 145 | } |
|