Skip to content

Commit 8713b1f

Browse files
committed
Add placeholder support. Add option to open picker on focus.
1 parent 89e7560 commit 8713b1f

File tree

3 files changed

+26
-1
lines changed

3 files changed

+26
-1
lines changed

README.md

+14
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,20 @@ Prevents date/time selections before this date
147147

148148

149149

150+
#### openOnFocus
151+
152+
Default: `false`
153+
154+
Accepts: `boolean`
155+
156+
```handlebars
157+
{{bs-datetimepicker date=myDate openOnFocus=true}}
158+
```
159+
160+
Opens the picker on input focus
161+
162+
163+
150164
#### showClear
151165

152166
Default: `false`

addon/components/bs-datetimepicker.js

+11
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ export default Component.extend({
1515
layout,
1616
tagName: 'div',
1717
classNames: ['input-group date'],
18+
placeholder: '',
19+
20+
openOnFocus: false,
1821

1922
iconClasses: computed('isTime', function() {
2023
if (this.get('isTime')) {
@@ -81,5 +84,13 @@ export default Component.extend({
8184
this.removeObserver('minDate');
8285

8386
this.$().data('DateTimePicker').destroy();
87+
},
88+
89+
actions: {
90+
focus() {
91+
if (this.get('openOnFocus')) {
92+
this.$().data('DateTimePicker').show();
93+
}
94+
}
8495
}
8596
});
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<input type="text" class="form-control">
1+
<input type="text" class="form-control" placeholder={{placeholder}} onfocus={{action 'focus'}}>
22
<span class="input-group-addon">
33
<i class={{iconClasses}}></i>
44
</span>

0 commit comments

Comments
 (0)