Changeset View
Changeset View
Standalone View
Standalone View
src/view/form/control/AphrontFormDateControl.php
| Show First 20 Lines • Show All 121 Lines • ▼ Show 20 Lines | public function setValue($epoch) { | ||||
| $this->valueDate = $month.'/'.$day.'/'.$year; | $this->valueDate = $month.'/'.$day.'/'.$year; | ||||
| $this->valueTime = $readable[3]; | $this->valueTime = $readable[3]; | ||||
| return $result; | return $result; | ||||
| } | } | ||||
| private function getDateInputValue() { | private function getDateInputValue() { | ||||
| return $this->valueDate; | $date_format = $this->getDateFormat(); | ||||
| $timezone = $this->getTimezone(); | |||||
| $datetime = new DateTime($this->valueDate, $timezone); | |||||
epriestley: Quotes unnecessary. | |||||
| $date = $datetime->format($date_format); | |||||
| return $date; | |||||
| } | |||||
| private function getDateFormat() { | |||||
| $viewer = $this->getUser(); | |||||
| $preferences = $viewer->loadPreferences(); | |||||
| $pref_date_format = PhabricatorUserPreferences::PREFERENCE_DATE_FORMAT; | |||||
| return $preferences->getPreference($pref_date_format, 'Y-m-d'); | |||||
Done Inline ActionsSpecifically, consider Y-m-d as a default here instead. epriestley: Specifically, consider Y-m-d as a default here instead. | |||||
| } | } | ||||
| private function getTimeInputValue() { | private function getTimeInputValue() { | ||||
| return $this->valueTime; | return $this->valueTime; | ||||
| } | } | ||||
| private function formatTime($epoch, $fmt) { | private function formatTime($epoch, $fmt) { | ||||
| return phabricator_format_local_time( | return phabricator_format_local_time( | ||||
| ▲ Show 20 Lines • Show All 98 Lines • ▼ Show 20 Lines | protected function renderInput() { | ||||
| $time_div = javelin_tag( | $time_div = javelin_tag( | ||||
| 'div', | 'div', | ||||
| array( | array( | ||||
| 'id' => $time_id, | 'id' => $time_id, | ||||
| 'class' => 'aphront-form-time-input-container', | 'class' => 'aphront-form-time-input-container', | ||||
| ), | ), | ||||
| $time_sel); | $time_sel); | ||||
| Javelin::initBehavior('fancy-datepicker', array()); | Javelin::initBehavior('fancy-datepicker', array( | ||||
| 'format' => $this->getDateFormat(), | |||||
| )); | |||||
| $classes = array(); | $classes = array(); | ||||
| $classes[] = 'aphront-form-date-container'; | $classes[] = 'aphront-form-date-container'; | ||||
| if ($disabled) { | if ($disabled) { | ||||
| $classes[] = 'datepicker-disabled'; | $classes[] = 'datepicker-disabled'; | ||||
| } | } | ||||
| if ($this->isTimeDisabled) { | if ($this->isTimeDisabled) { | ||||
| $classes[] = 'no-time'; | $classes[] = 'no-time'; | ||||
| ▲ Show 20 Lines • Show All 86 Lines • Show Last 20 Lines | |||||
Quotes unnecessary.