Ghost/ghost/admin/app/templates/components/gh-date-time-picker.hbs
Kevin Ansfield aa5b85d7c1 🐛 Fixed "scheduled at" datepicker not showing correct month when opening (#860)
closes https://github.com/TryGhost/Ghost/issues/8891

- set the `center` option as well as the `selected` option for `{{power-datepicker}}` inside `{{gh-date-time-picker}}` to force the month view to jump to the correct date when the selection changes
2017-09-19 09:51:52 +07:00

33 lines
1.3 KiB
Handlebars

<div class="gh-date-time-picker">
{{#power-datepicker
selected=_date
center=_date
onSelect=(action "setDate" value="date")
renderInPlace=true
disabled=disabled as |dp|
}}
{{#dp.trigger tabindex="-1" data-test-date-time-picker-datepicker=true}}
<div class="gh-date-time-picker-date {{if dateError "error"}}">
<input type="text" readonly value={{moment-format _date "MM/DD/YYYY"}} disabled={{disabled}} data-test-date-time-picker-date-input>
{{inline-svg "calendar"}}
</div>
{{/dp.trigger}}
{{#dp.content class="dropdown-menu"}}
{{dp.nav}}
{{dp.days minDate=_minDate maxDate=_maxDate weekdayFormat="min"}}
{{/dp.content}}
{{/power-datepicker}}
<div class="gh-date-time-picker-time {{if hasError "error"}}">
{{one-way-input _time
update=(action (mut _time))
focusOut=(action "setTime" _time)
disabled=disabled
data-test-date-time-picker-time-input=true}}
<small class="gh-date-time-picker-timezone">({{timezone}})</small>
</div>
</div>
{{#if hasError}}
<div class="gh-date-time-picker-error" data-test-date-time-picker-error>{{dateError}}{{timeError}}</div>
{{/if}}