Skip to content

Commit 3533af1

Browse files
authored
Merge pull request #19 from DavorPadovan/master
Support for en/disabledHours, en/disabledDates, sideBySide and widgetPositioning options added
2 parents 309032d + 449273b commit 3533af1

File tree

2 files changed

+61
-12
lines changed

2 files changed

+61
-12
lines changed

README.md

+55-11
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Basic example:
3636

3737
Returns: `date`, `null`
3838

39-
Fired when the date is changed
39+
Fired when the date is changed.
4040

4141

4242

@@ -52,7 +52,22 @@ Accepts: `date`, `moment`, `string`
5252
{{bs-datetimepicker date=myDate}}
5353
```
5454

55-
Sets the picker date/time
55+
Sets the picker date/time.
56+
57+
58+
59+
#### en/disabledHours
60+
61+
Default: `false`
62+
63+
Accepts: `array` of [`number`]
64+
65+
```handlebars
66+
{{bs-datetimepicker date=myDate disabledHours=disabledHours}}
67+
{{bs-datetimepicker date=myDate enabledHours=enabledHours}}
68+
```
69+
70+
Disables/enables selection of dates in the array.
5671

5772

5873

@@ -66,7 +81,7 @@ Accepts: `boolean`
6681
{{bs-datetimepicker date=myDate focusOnShow=false}}
6782
```
6883

69-
If `false`, the textbox will not be given focus when the picker is shown
84+
If `false`, the textbox will not be given focus when the picker is shown.
7085

7186

7287

@@ -115,7 +130,7 @@ Accepts: `string`, `moment.local('locale')`
115130
{{bs-datetimepicker date=myDate locale='de'}}
116131
```
117132

118-
Use the specified locale for text rendering
133+
Use the specified locale for text rendering.
119134

120135

121136

@@ -129,7 +144,7 @@ Accepts: `date`, `moment`, `string`
129144
{{bs-datetimepicker date=myDate maxDate=myMaxDate}}
130145
```
131146

132-
Prevents date/time selections after this date
147+
Prevents date/time selections after this date.
133148

134149

135150

@@ -143,7 +158,7 @@ Accepts: `date`, `moment`, `string`
143158
{{bs-datetimepicker date=myDate minDate=myMinDate}}
144159
```
145160

146-
Prevents date/time selections before this date
161+
Prevents date/time selections before this date.
147162

148163

149164

@@ -157,21 +172,22 @@ Accepts: `array` of [`number`]
157172
{{bs-datetimepicker daysOfWeekDisabled=daysOfWeekDisabled}}
158173
```
159174

160-
Disables selection of days in the array, e.g. sundays
175+
Disables selection of days in the array, e.g. sundays.
161176

162177

163178

164-
#### disabledDates
179+
#### en/disabledDates
165180

166181
Default: `false`
167182

168183
Accepts: `array` of [`date`, `moment`, `string`]
169184

170185
```handlebars
171186
{{bs-datetimepicker disabledDates=disabledDates}}
187+
{{bs-datetimepicker enabledDates=enabledDates}}
172188
```
173189

174-
Disables selection of dates in the array, e.g. holidays
190+
Disables/enables selection of dates in the array, e.g. holidays.
175191

176192

177193

@@ -185,7 +201,7 @@ Accepts: `boolean`
185201
{{bs-datetimepicker date=myDate openOnFocus=true}}
186202
```
187203

188-
Opens the picker on input focus
204+
Opens the picker on input focus.
189205

190206

191207

@@ -215,7 +231,7 @@ Accepts: `boolean`
215231
```
216232

217233
Show the *Close* button in the icon toolbar.
218-
Clicking the *Close* button will call `hide()`
234+
Clicking the *Close* button will call `hide()`.
219235

220236

221237

@@ -234,6 +250,20 @@ Clicking the *Today* button will set the calendar view and set the date to `now`
234250

235251

236252

253+
#### sideBySide
254+
255+
Default: `false`
256+
257+
Accepts: `boolean`
258+
259+
```handlebars
260+
{{bs-datetimepicker date=myDate sideBySide=true}}
261+
```
262+
263+
Show calendar and time side by side.
264+
265+
266+
237267
#### useCurrent
238268

239269
Default: `false`
@@ -278,6 +308,20 @@ The default view to display when the picker is shown.
278308

279309

280310

311+
#### widgetPositioning
312+
313+
Default: `{ horizontal: 'auto', vertical: 'auto' }`
314+
315+
Accepts: `object` with all or one of the parameters above (horizontal: 'auto', 'left', 'right'; vertical: 'auto', 'top', 'bottom')
316+
317+
```handlebars
318+
{{bs-datetimepicker date=myDate widgetPositioning=widgetPositioning}}
319+
```
320+
321+
Will position widget according to the parameters given in object.
322+
323+
324+
281325
## License
282326

283327
[MIT License](https://github.com/btecu/ember-cli-bootstrap-datetimepicker/blob/master/LICENSE.md)

addon/components/bs-datetimepicker.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ export default Component.extend({
4646
date: this.getWithDefault('date', defaults.defaultDate),
4747
daysOfWeekDisabled: this.getWithDefault('daysOfWeekDisabled', defaults.daysOfWeekDisabled),
4848
disabledDates: this.getWithDefault('disabledDates', defaults.disabledDates),
49+
disabledHours: this.getWithDefault('disabledHours', defaults.disabledHours),
50+
enabledDates: this.getWithDefault('enabledDates', defaults.enabledDates),
51+
enabledHours: this.getWithDefault('enabledHours', defaults.enabledHours),
4952
focusOnShow: this.getWithDefault('focusOnShow', defaults.focusOnShow),
5053
format: this.getWithDefault('format', defaults.format),
5154
icons,
@@ -55,9 +58,11 @@ export default Component.extend({
5558
showClear: this.getWithDefault('showClear', defaults.showClear),
5659
showClose: this.getWithDefault('showClose', defaults.showClose),
5760
showTodayButton: this.getWithDefault('showTodayButton', defaults.showTodayButton),
61+
sideBySide: this.getWithDefault('sideBySide', defaults.sideBySide),
5862
useCurrent: this.getWithDefault('useCurrent', false),
5963
viewDate: this.getWithDefault('viewDate', defaults.viewDate),
60-
viewMode: this.getWithDefault('viewMode', defaults.viewMode)
64+
viewMode: this.getWithDefault('viewMode', defaults.viewMode),
65+
widgetPositioning: this.getWithDefault('widgetPositioning', defaults.widgetPositioning)
6166
}).on('dp.change', e => {
6267
// Convert moment to js date or default to null
6368
let newDate = e.date && e.date.toDate() || null;

0 commit comments

Comments
 (0)