Skip to content

Commit

Permalink
Default value
Browse files Browse the repository at this point in the history
Default value not showing when just using timePicker
  • Loading branch information
Gillardo committed Mar 13, 2015
1 parent 08481d7 commit 4a2be7c
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 19 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bootstrap-ui-datetime-picker",
"version": "1.0.9",
"version": "1.0.10",
"homepage": "https://github.com/Gillardo/bootstrap-ui-datetime-picker",
"authors": [
"Gillardo <[email protected]>"
Expand Down
16 changes: 9 additions & 7 deletions datetime-picker.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@
// popup element used to display calendar
var popupEl = angular.element('' +
'<div datetime-picker-popup>' +
'<div ng-if="enableDate" collapse="!(showPicker == \'date\')" datepicker></div>' +
'<div collapse="!(showPicker == \'time\')">' +
'<div timepicker style="margin:0 auto"></div>' +
'</div>' +
'<div ng-if="enableDate" collapse="!(showPicker == \'date\')" datepicker></div>' +
'<div collapse="!(showPicker == \'time\')">' +
'<div timepicker style="margin:0 auto"></div>' +
'</div>' +
'</div>');

// get attributes from directive
Expand Down Expand Up @@ -121,10 +121,12 @@
// with the time added on the end, and a dummy formatter
// and use this to see if the time is valid
if (scope.enableTime && !scope.enableDate) {
var timeFormat = 'EEE MMM dd yyyy ' + dateFormat;
var newTime = 'Fri Mar 12 2015 ' + viewValue;
if (viewValue.length == dateFormat.length) {
var timeFormat = 'EEE MMM dd yyyy ' + dateFormat;
var newTime = 'Fri Mar 12 2015 ' + viewValue;

date = dateParser.parse(newTime, timeFormat) || new Date(newTime);
date = dateParser.parse(newTime, timeFormat) || new Date(newTime);
}
}

if (isNaN(date)) {
Expand Down
18 changes: 10 additions & 8 deletions dist/datetime-picker.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// https://github.com/Gillardo/bootstrap-ui-datetime-picker
// Version: 1.0.9
// Version: 1.0.10
// Released: 2015-03-13
angular.module('ui.bootstrap.datetimepicker', ['ui.bootstrap.dateparser', 'ui.bootstrap.position'])
.directive('datetimePicker', ['$compile', '$parse', '$document', '$position', 'dateFilter', 'dateParser', 'datepickerPopupConfig',
Expand Down Expand Up @@ -53,10 +53,10 @@ angular.module('ui.bootstrap.datetimepicker', ['ui.bootstrap.dateparser', 'ui.bo
// popup element used to display calendar
var popupEl = angular.element('' +
'<div datetime-picker-popup>' +
'<div ng-if="enableDate" collapse="!(showPicker == \'date\')" datepicker></div>' +
'<div collapse="!(showPicker == \'time\')">' +
'<div timepicker style="margin:0 auto"></div>' +
'</div>' +
'<div ng-if="enableDate" collapse="!(showPicker == \'date\')" datepicker></div>' +
'<div collapse="!(showPicker == \'time\')">' +
'<div timepicker style="margin:0 auto"></div>' +
'</div>' +
'</div>');

// get attributes from directive
Expand Down Expand Up @@ -124,10 +124,12 @@ angular.module('ui.bootstrap.datetimepicker', ['ui.bootstrap.dateparser', 'ui.bo
// with the time added on the end, and a dummy formatter
// and use this to see if the time is valid
if (scope.enableTime && !scope.enableDate) {
var timeFormat = 'EEE MMM dd yyyy ' + dateFormat;
var newTime = 'Fri Mar 12 2015 ' + viewValue;
if (viewValue.length == dateFormat.length) {
var timeFormat = 'EEE MMM dd yyyy ' + dateFormat;
var newTime = 'Fri Mar 12 2015 ' + viewValue;

date = dateParser.parse(newTime, timeFormat) || new Date(newTime);
date = dateParser.parse(newTime, timeFormat) || new Date(newTime);
}
}

if (isNaN(date)) {
Expand Down
4 changes: 2 additions & 2 deletions dist/datetime-picker.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "bootstrap-ui-datetime-picker",
"url": "https://github.com/Gillardo/bootstrap-ui-datetime-picker",
"version": "1.0.9",
"version": "1.0.10",
"devDependencies": {
"grunt": "^0.4.5",
"grunt-angular-templates": "^0.5.7",
Expand Down

0 comments on commit 4a2be7c

Please sign in to comment.