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

Commit

Permalink
Switch on click #39 #47
Browse files Browse the repository at this point in the history
  • Loading branch information
T00rk committed Jan 30, 2016
1 parent 986126f commit 0915340
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Originaly designed for Bootstrap Material, the V2.0 is now completely standalone

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

### Live Example

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

### Usage

Expand All @@ -63,6 +64,7 @@ Click [here](http://t00rk.github.io/bootstrap-material-datetimepicker/) to see
| **time** | Boolean | true => Has Timepicker |
| **clearButton** | Boolean | true => Show Clear Button |
| **nowButton** | Boolean | true => Show Now Button |
| **switchOnClick** | Boolean | true => Switch view on click (default: false) |
| **cancelText** | String | Text for the cancel button (default: Cancel) |
| **okText** | String | Text for the OK button (default: OK) |
| **clearText** | String | Text for the Clear button (default: Clear) |
Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "bootstrap-material-datetimepicker",
"description": ".",
"version": "2.5.2",
"version": "2.5.3",
"keywords": [
"css",
"js",
Expand Down
8 changes: 7 additions & 1 deletion js/bootstrap-material-datetimepicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
this.element = element;
this.$element = $(element);

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' };
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 };
this.params = $.fn.extend(this.params, options);

this.name = "dtp_" + this.setName();
Expand Down Expand Up @@ -1066,6 +1066,9 @@
$(e.currentTarget).addClass('selected');

this.selectDate($(e.currentTarget).parent().data("date"));

if(this.params.switchOnClick === true && this.params.time === true)
setTimeout(this.initHours.bind(this), 200);
},
_onSelectHour: function(e)
{
Expand All @@ -1082,6 +1085,9 @@
this.showTime(this.currentDate);

this.animateHands();

if(this.params.switchOnClick === true)
setTimeout(this.initMinutes.bind(this), 200);
},
_onSelectMinute: function(e)
{
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "bootstrap-material-datetimepicker",
"description": ".",
"version": "2.5.2",
"version": "2.5.3",
"keywords": [
"css",
"js",
Expand Down

0 comments on commit 0915340

Please sign in to comment.