Skip to content
This repository was archived by the owner on Mar 24, 2022. It is now read-only.

Commit 0915340

Browse files
committed
Switch on click #39 #47
1 parent 986126f commit 0915340

File tree

4 files changed

+12
-4
lines changed

4 files changed

+12
-4
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Originaly designed for Bootstrap Material, the V2.0 is now completely standalone
77

88
| Date | Author | Description |
99
| ----------------- | ----------------- | ------------------------------------------------------ |
10+
| 2016-01-30 | T00rk | Switch view on click (#39, #47) |
1011
| 2016-01-29 | T00rk | Added "clear button" (#48) |
1112
| 2016-01-29 | T00rk | Replace rem by em (#26) |
1213
| 2016-01-29 | T00rk | Display 24H clock (#54) |
@@ -40,7 +41,7 @@ Google Material Icon Font `<link href="https://fonts.googleapis.com/icon?family=
4041

4142
### Live Example
4243

43-
Click [here](http://t00rk.github.io/bootstrap-material-datetimepicker/) to see
44+
[Live example](http://t00rk.github.io/bootstrap-material-datetimepicker/)
4445

4546
### Usage
4647

@@ -63,6 +64,7 @@ Click [here](http://t00rk.github.io/bootstrap-material-datetimepicker/) to see
6364
| **time** | Boolean | true => Has Timepicker |
6465
| **clearButton** | Boolean | true => Show Clear Button |
6566
| **nowButton** | Boolean | true => Show Now Button |
67+
| **switchOnClick** | Boolean | true => Switch view on click (default: false) |
6668
| **cancelText** | String | Text for the cancel button (default: Cancel) |
6769
| **okText** | String | Text for the OK button (default: OK) |
6870
| **clearText** | String | Text for the Clear button (default: Clear) |

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "bootstrap-material-datetimepicker",
33
"description": ".",
4-
"version": "2.5.2",
4+
"version": "2.5.3",
55
"keywords": [
66
"css",
77
"js",

js/bootstrap-material-datetimepicker.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
this.element = element;
1818
this.$element = $(element);
1919

20-
this.params = { date : true, time : true, format : 'YYYY-MM-DD', minDate : null, maxDate : null, currentDate : null, lang : 'en', weekStart : 0, shortTime : false, clearButton : false, nowButton : false, 'cancelText' : 'Cancel', 'okText' : 'OK', 'clearText' : 'Clear', 'nowText' : 'Now' };
20+
this.params = { date : true, time : true, format : 'YYYY-MM-DD', minDate : null, maxDate : null, currentDate : null, lang : 'en', weekStart : 0, shortTime : false, clearButton : false, nowButton : false, cancelText : 'Cancel', okText : 'OK', clearText : 'Clear', nowText : 'Now', switchOnClick : false };
2121
this.params = $.fn.extend(this.params, options);
2222

2323
this.name = "dtp_" + this.setName();
@@ -1066,6 +1066,9 @@
10661066
$(e.currentTarget).addClass('selected');
10671067

10681068
this.selectDate($(e.currentTarget).parent().data("date"));
1069+
1070+
if(this.params.switchOnClick === true && this.params.time === true)
1071+
setTimeout(this.initHours.bind(this), 200);
10691072
},
10701073
_onSelectHour: function(e)
10711074
{
@@ -1082,6 +1085,9 @@
10821085
this.showTime(this.currentDate);
10831086

10841087
this.animateHands();
1088+
1089+
if(this.params.switchOnClick === true)
1090+
setTimeout(this.initMinutes.bind(this), 200);
10851091
},
10861092
_onSelectMinute: function(e)
10871093
{

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "bootstrap-material-datetimepicker",
33
"description": ".",
4-
"version": "2.5.2",
4+
"version": "2.5.3",
55
"keywords": [
66
"css",
77
"js",

0 commit comments

Comments
 (0)