From c4143c6a5c62ced308d204b9cff5569a08199e5b Mon Sep 17 00:00:00 2001 From: santiagovazquez Date: Mon, 5 Oct 2015 15:19:43 -0300 Subject: [PATCH 1/8] Adding DS_Store hidden folder to gitignore for mac developers --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 5c3897c..2d794e8 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ node_modules app/components .idea *.iml +.DS_Store From 597fca447bea7f636e2d76c0a9971b2aeac71a01 Mon Sep 17 00:00:00 2001 From: santiagovazquez Date: Mon, 5 Oct 2015 16:15:39 -0300 Subject: [PATCH 2/8] Adding necessary dependencies to build the project --- package.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/package.json b/package.json index f98c1eb..07e79c7 100644 --- a/package.json +++ b/package.json @@ -7,9 +7,11 @@ }, "dependencies": {}, "devDependencies": { + "bower": "1.5.3", "grunt": "0.4.5", "grunt-angular-templates": "0.5.7", "grunt-bump": "0.3.1", + "grunt-cli": "0.1.13", "grunt-concurrent": "1.0.1", "grunt-contrib-clean": "0.6.0", "grunt-contrib-concat": "0.5.1", From c0ae81540ae289334a341289a1ffbec6efd3cd4d Mon Sep 17 00:00:00 2001 From: santiagovazquez Date: Mon, 5 Oct 2015 16:38:30 -0300 Subject: [PATCH 3/8] Adding grunt-watch missing dependency --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index 07e79c7..9c2982b 100644 --- a/package.json +++ b/package.json @@ -22,6 +22,7 @@ "grunt-contrib-less": "1.0.1", "grunt-contrib-livereload": "0.1.2", "grunt-contrib-uglify": "0.9.1", + "grunt-contrib-watch": "0.6.1", "grunt-karma": "0.11.0", "grunt-ng-annotate": "1.0.1", "grunt-ngmin": "0.0.3", From b2b4ad1511de00d92a3995a4f2db9dda3b70c3f3 Mon Sep 17 00:00:00 2001 From: santiagovazquez Date: Mon, 5 Oct 2015 16:39:08 -0300 Subject: [PATCH 4/8] Changing recess to less --- Gruntfile.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index f5e3b8f..85a3cfd 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -25,7 +25,7 @@ module.exports = function (grunt) { watch: { less: { files: ['<%= yeoman.app %>/styles/{,*/}*.less'], - tasks: ['recess', 'copy:styles'], + tasks: ['less', 'copy:styles'], options: { nospawn: true } @@ -168,7 +168,7 @@ module.exports = function (grunt) { }, concurrent: { server: [ - 'recess', + 'less', 'copy:styles' ], test: [ @@ -211,7 +211,7 @@ module.exports = function (grunt) { grunt.registerTask('server', [ 'clean:server', - 'recess', + 'less', 'concurrent:server', 'connect:livereload', 'open', From 6b9a3e11b965a2e171bd67e86a08941f3e5e31ed Mon Sep 17 00:00:00 2001 From: santiagovazquez Date: Mon, 5 Oct 2015 17:16:34 -0300 Subject: [PATCH 5/8] Using browser timezone. Removing test from a missing utility function. --- app/scripts/datePickerUtils.js | 6 +-- karma.conf.js | 2 +- test/spec/datePickerUtilsTest.js | 86 +++++++++++++++++++++----------- 3 files changed, 61 insertions(+), 33 deletions(-) diff --git a/app/scripts/datePickerUtils.js b/app/scripts/datePickerUtils.js index dc68a28..ae89857 100644 --- a/app/scripts/datePickerUtils.js +++ b/app/scripts/datePickerUtils.js @@ -3,7 +3,7 @@ angular.module('datePicker').factory('datePickerUtils', function(){ var createNewDate = function(year, month, day, hour, minute) { // without any arguments, the default date will be 1899-12-31T00:00:00.000Z - return new Date(Date.UTC(year | 0, month | 0, day | 0, hour | 0, minute | 0)); + return new Date(year | 0, month | 0, day | 0, hour | 0, minute | 0); }; return { getVisibleMinutes : function(date, step) { @@ -11,7 +11,7 @@ angular.module('datePicker').factory('datePickerUtils', function(){ var year = date.getFullYear(); var month = date.getMonth(); var day = date.getDate(); - var hour = date.getUTCHours(); + var hour = date.getHours(); var minutes = []; var minute, pushedDate; for (minute = 0 ; minute < 60 ; minute += step) { @@ -158,4 +158,4 @@ angular.module('datePicker').factory('datePickerUtils', function(){ } */ }; -}); \ No newline at end of file +}); diff --git a/karma.conf.js b/karma.conf.js index d3529c2..019702c 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -47,7 +47,7 @@ module.exports = function (config) { // - Safari (only Mac) // - PhantomJS // - IE (only Windows) - browsers : [ 'PhantomJS' ], + browsers : [ 'Chrome' ], plugins : [ 'karma-chrome-launcher', 'karma-firefox-launcher', 'karma-script-launcher', 'karma-phantomjs-launcher', 'karma-jasmine' ], diff --git a/test/spec/datePickerUtilsTest.js b/test/spec/datePickerUtilsTest.js index 0a19898..f5d54a8 100644 --- a/test/spec/datePickerUtilsTest.js +++ b/test/spec/datePickerUtilsTest.js @@ -1,7 +1,34 @@ describe('Test date Picker Utils', function(){ var utils, constants; - var model = new Date('2014-06-29T19:00:00.000Z'); // sunday + /** + * Getting timezone offset string + * @see http://stackoverflow.com/questions/1091372/getting-the-clients-timezone-in-javascript + */ + function getTimezoneAsString() { + function pad(number, length){ + var str = "" + number + while (str.length < length) { + str = '0'+str + } + return str + } + + var offset = new Date().getTimezoneOffset(); + + return ((offset < 0 ? '+':'-') + // Note the reversed sign! + pad(parseInt(Math.abs(offset/60)), 2) + pad(Math.abs(offset%60), 2)); + } + + /** + * Building a date from an ISO string with current browser TZ + * Not valid for phantomJS (@see https://github.com/ariya/phantomjs/issues/10187) + */ + function dateBuilder(isoStringWithoutTZ) { + return new Date(isoStringWithoutTZ + getTimezoneAsString()); + } + + var model = dateBuilder('2014-06-29T19:00:00.000'); // sunday beforeEach(angular.mock.module('datePicker')); @@ -17,9 +44,10 @@ describe('Test date Picker Utils', function(){ }); it('get visible mins provided date', function(){ - var start = new Date('2014-06-29T19:00:00.000Z'); // sunday - var end = new Date('2014-06-29T19:55:00.000Z'); // sunday - var chosen = new Date('2014-06-29T19:00:00.000Z'); // sunday + + var start = dateBuilder('2014-06-29T19:00:00.000'); // sunday + var end = dateBuilder('2014-06-29T19:55:00.000'); // sunday + var chosen = dateBuilder('2014-06-29T19:00:00.000'); // sunday var mins = utils.getVisibleMinutes(chosen, constants.step); expect(mins).toBeDefined(); @@ -34,9 +62,9 @@ describe('Test date Picker Utils', function(){ }); it('get visible weeks provided date', function(){ - var start = new Date('2014-05-26T00:00:00.000Z'); // monday - var end = new Date('2014-07-06T00:00:00.000Z'); // sunday - var chosen = new Date('2014-06-29T19:00:00.000Z'); // sunday + var start = dateBuilder('2014-05-26T00:00:00.000'); // monday + var end = dateBuilder('2014-07-06T00:00:00.000'); // sunday + var chosen = ('2014-06-29T19:00:00.000'); // sunday var weeks = utils.getVisibleWeeks(chosen, constants.step); expect(weeks).toBeDefined(); @@ -51,9 +79,9 @@ describe('Test date Picker Utils', function(){ }); it('get visible years provided date', function(){ - var start = new Date('2009-12-31T00:00:00.000Z'); // thursday - var end = new Date('2020-12-31T00:00:00.000Z'); // wednesday - var chosen = new Date('2014-06-29T19:00:00.000Z'); // sunday + var start = dateBuilder('2009-12-31T00:00:00.000'); // thursday + var end = dateBuilder('2020-12-31T00:00:00.000'); // wednesday + var chosen = dateBuilder('2014-06-29T19:00:00.000'); // sunday var years = utils.getVisibleYears(chosen, constants.step); expect(years).toBeDefined(); @@ -68,8 +96,8 @@ describe('Test date Picker Utils', function(){ }); it('get days of week provided date', function(){ - var start = new Date('2014-05-26T00:00:00.000Z'); // monday - var end = new Date('2014-06-01T00:00:00.000Z'); // sunday + var start = dateBuilder('2014-05-26T00:00:00.000'); // monday + var end = dateBuilder('2014-06-01T00:00:00.000'); // sunday var days = utils.getDaysOfWeek(start); expect(days).toBeDefined(); @@ -84,9 +112,9 @@ describe('Test date Picker Utils', function(){ }); it('get default months provided date', function(){ - var start = new Date('2014-01-01T00:00:00.000Z'); // wednesday - var end = new Date('2014-12-01T00:00:00.000Z'); // monday - var chosen = new Date('2014-06-29T19:00:00.000Z'); // sunday + var start = dateBuilder('2014-01-01T00:00:00.000'); // wednesday + var end = dateBuilder('2014-12-01T00:00:00.000'); // monday + var chosen = dateBuilder('2014-06-29T19:00:00.000'); // sunday var months = utils.getVisibleMonths(chosen); expect(months).toBeDefined(); @@ -101,9 +129,9 @@ describe('Test date Picker Utils', function(){ }); it('get default hours provided date', function(){ - var start = new Date('2014-06-29T00:00:00.000Z'); // sunday - var end = new Date('2014-06-29T23:00:00.000Z'); // sunday - var chosen = new Date('2014-06-29T19:00:00.000Z'); // sunday + var start = dateBuilder('2014-06-29T00:00:00.000'); // sunday + var end = dateBuilder('2014-06-29T23:00:00.000'); // sunday + var chosen = dateBuilder('2014-06-29T19:00:00.000'); // sunday var hours = utils.getVisibleHours(chosen); expect(hours).toBeDefined(); @@ -113,7 +141,7 @@ describe('Test date Picker Utils', function(){ it('model is after date', function(){ // model is 19h, dateAfter is 20h, so model should be before and not after - var dateAfter = new Date('2014-06-29T20:00:00.000Z'); // sunday + var dateAfter = dateBuilder('2014-06-29T20:00:00.000'); // sunday expect(utils.isAfter(model, dateAfter)).toBe(false); expect(utils.isBefore(model, dateAfter)).toBe(true); @@ -121,14 +149,14 @@ describe('Test date Picker Utils', function(){ it('model is before date', function(){ // model is 19h, dateAfter is 18h, so model should be after and not before - var dateAfter = new Date('2014-06-29T18:00:00.000Z'); // sunday + var dateAfter = dateBuilder('2014-06-29T18:00:00.000'); // sunday expect(utils.isAfter(model, dateAfter)).toBe(true); expect(utils.isBefore(model, dateAfter)).toBe(false); }); it('model is almost same', function(){ - var dateSimilar = new Date('2014-06-29T19:00:55.555Z'); // sunday + var dateSimilar = dateBuilder('2014-06-29T19:00:55.555'); // sunday expect(utils.isSameYear(model, dateSimilar)).toBe(true); expect(utils.isSameMonth(model, dateSimilar)).toBe(true); @@ -137,11 +165,11 @@ describe('Test date Picker Utils', function(){ expect(utils.isSameMinutes(model, dateSimilar)).toBe(true); }); - it('angular date format is a moment format', function () { - //Angular formats: https://docs.angularjs.org/api/ng/filter/date - //Moment formats: http://momentjs.com/docs/#/parsing/string-format/ - expect(utils.toMomentFormat('dd-MM-yyyy')).toBe('DD-MM-YYYY'); - expect(utils.toMomentFormat('EEEE MM/yy')).toBe('dddd MM/YY'); - expect(utils.toMomentFormat('dd MMMM yyyy HH:mm:ss.sss')).toBe('DD MMMM YYYY HH:mm:ss.SSS'); - }); -}); \ No newline at end of file + //it('angular date format is a moment format', function () { + // //Angular formats: https://docs.angularjs.org/api/ng/filter/date + // //Moment formats: http://momentjs.com/docs/#/parsing/string-format/ + // expect(utils.toMomentFormat('dd-MM-yyyy')).toBe('DD-MM-YYYY'); + // expect(utils.toMomentFormat('EEEE MM/yy')).toBe('dddd MM/YY'); + // expect(utils.toMomentFormat('dd MMMM yyyy HH:mm:ss.sss')).toBe('DD MMMM YYYY HH:mm:ss.SSS'); + //}); +}); From 09f74534ce439642ba5d42d6f2d4921167ba9d0a Mon Sep 17 00:00:00 2001 From: santiagovazquez Date: Mon, 5 Oct 2015 17:45:41 -0300 Subject: [PATCH 6/8] build from previous changes --- dist/angular-datepicker.js | 376 +++++++++++--------------------- dist/angular-datepicker.min.css | 2 +- dist/angular-datepicker.min.js | 2 +- 3 files changed, 127 insertions(+), 253 deletions(-) diff --git a/dist/angular-datepicker.js b/dist/angular-datepicker.js index de804ee..24eba79 100644 --- a/dist/angular-datepicker.js +++ b/dist/angular-datepicker.js @@ -1,7 +1,5 @@ 'use strict'; (function(angular){ -'use strict'; - var Module = angular.module('datePicker', []); Module.constant('datePickerConfig', { @@ -267,12 +265,10 @@ Module.directive('datePicker', ['datePickerConfig', 'datePickerUtils', function }; }]); -'use strict'; - angular.module('datePicker').factory('datePickerUtils', function(){ var createNewDate = function(year, month, day, hour, minute) { // without any arguments, the default date will be 1899-12-31T00:00:00.000Z - return new Date(Date.UTC(year | 0, month | 0, day | 0, hour | 0, minute | 0)); + return new Date(year | 0, month | 0, day | 0, hour | 0, minute | 0); }; return { getVisibleMinutes : function(date, step) { @@ -280,7 +276,7 @@ angular.module('datePicker').factory('datePickerUtils', function(){ var year = date.getFullYear(); var month = date.getMonth(); var day = date.getDate(); - var hour = date.getUTCHours(); + var hour = date.getHours(); var minutes = []; var minute, pushedDate; for (minute = 0 ; minute < 60 ; minute += step) { @@ -428,7 +424,6 @@ angular.module('datePicker').factory('datePickerUtils', function(){ */ }; }); -'use strict'; var Module = angular.module('datePicker'); @@ -464,8 +459,6 @@ Module.directive('dateRange', function () { }; }); -'use strict'; - var PRISTINE_CLASS = 'ng-pristine', DIRTY_CLASS = 'ng-dirty'; @@ -653,250 +646,131 @@ Module.directive('dateTime', ['$compile', '$document', '$filter', 'dateTimeConfi }; }]); -angular.module("datePicker").run(["$templateCache", function($templateCache) { - - $templateCache.put("templates/datepicker.html", - "
\r" + - "\n" + - "
\r" + - "\n" + - " \r" + - "\n" + - " \r" + - "\n" + - " \r" + - "\n" + - " \r" + - "\n" + - " \r" + - "\n" + - " \r" + - "\n" + - " \r" + - "\n" + - " \r" + - "\n" + - " \r" + - "\n" + - " \r" + - "\n" + - " \r" + - "\n" + - " \r" + - "\n" + - " \r" + - "\n" + - " \r" + - "\n" + - " \r" + - "\n" + - " \r" + - "\n" + - "
\r" + - "\n" + - " \r" + - "\n" + - "
\r" + - "\n" + - "
\r" + - "\n" + - "
\r" + - "\n" + - " \r" + - "\n" + - " \r" + - "\n" + - " \r" + - "\n" + - " \r" + - "\n" + - " \r" + - "\n" + - " \r" + - "\n" + - " \r" + - "\n" + - " \r" + - "\n" + - " \r" + - "\n" + - " \r" + - "\n" + - " \r" + - "\n" + - " \r" + - "\n" + - " \r" + - "\n" + - "
\r" + - "\n" + - " \r" + - "\n" + - "
\r" + - "\n" + - "
\r" + - "\n" + - "
\r" + - "\n" + - " \r" + - "\n" + - " \r" + - "\n" + - " \r" + - "\n" + - " \r" + - "\n" + - " \r" + - "\n" + - " \r" + - "\n" + - " \r" + - "\n" + - " \r" + - "\n" + - " \r" + - "\n" + - " \r" + - "\n" + - " \r" + - "\n" + - " \r" + - "\n" + - " \r" + - "\n" + - "
\r" + - "\n" + - " \r" + - "\n" + - "
\r" + - "\n" + - "
\r" + - "\n" + - "
\r" + - "\n" + - " \r" + - "\n" + - " \r" + - "\n" + - " \r" + - "\n" + - " \r" + - "\n" + - " \r" + - "\n" + - " \r" + - "\n" + - " \r" + - "\n" + - " \r" + - "\n" + - " \r" + - "\n" + - " \r" + - "\n" + - " \r" + - "\n" + - " \r" + - "\n" + - " \r" + - "\n" + - "
\r" + - "\n" + - " \r" + - "\n" + - "
\r" + - "\n" + - "
\r" + - "\n" + - "
\r" + - "\n" + - " \r" + - "\n" + - " \r" + - "\n" + - " \r" + - "\n" + - " \r" + - "\n" + - " \r" + - "\n" + - " \r" + - "\n" + - " \r" + - "\n" + - " \r" + - "\n" + - " \r" + - "\n" + - " \r" + - "\n" + - " \r" + - "\n" + - " \r" + - "\n" + - " \r" + - "\n" + - "
\r" + - "\n" + - " \r" + - "\n" + - "
\r" + - "\n" + - "
\r" + - "\n" + - "
\r" + - "\n" +angular.module('datePicker').run(['$templateCache', function($templateCache) { +$templateCache.put('app/templates/datepicker.html', + "
\n" + + "
\n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + "
\n" + + " \n" + + "
\n" + + "
\n" + + "
\n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + "
\n" + + " \n" + + "
\n" + + "
\n" + + "
\n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + "
\n" + + " \n" + + "
\n" + + "
\n" + + "
\n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + "
\n" + + " \n" + + "
\n" + + "
\n" + + "
\n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + "
\n" + + " \n" + + "
\n" + + "
\n" + + "
\n" ); - $templateCache.put("templates/daterange.html", - "
\r" + - "\n" + - " \r" + - "\n" + - " \r" + - "\n" + - " \r" + - "\n" + - " \r" + - "\n" + - " \r" + - "\n" + - "
\r" + - "\n" + - "
\r" + - "\n" + - "
\r" + - "\n" + - "
\r" + - "\n" + - "
\r" + - "\n" + - "
\r" + - "\n" + + $templateCache.put('app/templates/daterange.html', + "
\n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + "
\n" + + "
\n" + + "
\n" + + "
\n" + + "
\n" + + "
\n" ); }]); diff --git a/dist/angular-datepicker.min.css b/dist/angular-datepicker.min.css index 1d7caba..ce2cdcf 100644 --- a/dist/angular-datepicker.min.css +++ b/dist/angular-datepicker.min.css @@ -1 +1 @@ -.clearfix{*zoom:1}.clearfix:before,.clearfix:after{display:table;content:"";line-height:0}.clearfix:after{clear:both}.hide-text{font:0/0 a;color:transparent;text-shadow:none;background-color:transparent;border:0}.input-block-level{display:block;width:100%;min-height:30px;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.date-picker-date-time{position:absolute}[date-picker-wrapper]{position:absolute;min-width:220px;z-index:10;display:block;font-size:14px}[date-time-append] [date-picker-wrapper] [date-picker]{margin-top:-30px}[date-time-append] [date-picker]{position:relative;margin-right:-1000px;margin-bottom:-1000px}[date-range] [date-picker] .after.before{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,.25);background-color:#499dcd;background-image:-moz-linear-gradient(top,#5bc0de,#2f6ab4);background-image:-webkit-gradient(linear,0 0,0 100%,from(#5bc0de),to(#2f6ab4));background-image:-webkit-linear-gradient(top,#5bc0de,#2f6ab4);background-image:-o-linear-gradient(top,#5bc0de,#2f6ab4);background-image:linear-gradient(to bottom,#5bc0de,#2f6ab4);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5bc0de', endColorstr='#ff2f6ab4', GradientType=0);border-color:#2f6ab4 #2f6ab4 #1f4677;border-color:rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25);*background-color:#2f6ab4;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}[date-range] [date-picker] .after.before:hover,[date-range] [date-picker] .after.before:active,[date-range] [date-picker] .after.before.active,[date-range] [date-picker] .after.before.disabled,[date-range] [date-picker] .after.before[disabled]{color:#fff;background-color:#2f6ab4;*background-color:#2a5ea0}[date-range] [date-picker] .after.before:active,[date-range] [date-picker] .after.before.active{background-color:#24528c \9}[date-picker].hidden{display:none}[date-picker]{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;-o-user-select:none;user-select:none;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;background-color:#fff;padding:4px}[date-picker] table{margin:0}[date-picker] td,[date-picker] th{padding:4px 5px;text-align:center;width:20px;height:20px;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;border:0}[date-picker] .switch{width:145px}[date-picker] span{display:block;width:23%;height:26px;line-height:25px;float:left;margin:1%;cursor:pointer;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px}[date-picker] span:hover{background:#eee}[date-picker] span.disabled,[date-picker] span.disabled:hover{background:0;color:#999;cursor:default}[date-picker] .active,[date-picker] .now{color:#fff;background-color:#006dcc;background-image:-moz-linear-gradient(top,#08c,#04c);background-image:-webkit-gradient(linear,0 0,0 100%,from(#08c),to(#04c));background-image:-webkit-linear-gradient(top,#08c,#04c);background-image:-o-linear-gradient(top,#08c,#04c);background-image:linear-gradient(to bottom,#08c,#04c);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0088cc', endColorstr='#ff0044cc', GradientType=0);border-color:#04c #04c #002a80;border-color:rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25);*background-color:#04c;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,.25)}[date-picker] .active:hover,[date-picker] .now:hover,[date-picker] .active:active,[date-picker] .now:active,[date-picker] .active.active,[date-picker] .now.active,[date-picker] .active.disabled,[date-picker] .now.disabled,[date-picker] .active[disabled],[date-picker] .now[disabled]{color:#fff;background-color:#04c;*background-color:#003bb3}[date-picker] .active:active,[date-picker] .now:active,[date-picker] .active.active,[date-picker] .now.active{background-color:#039 \9}[date-picker] .now{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,.25);background-color:#ee735b;background-image:-moz-linear-gradient(top,#ee5f5b,#ee905b);background-image:-webkit-gradient(linear,0 0,0 100%,from(#ee5f5b),to(#ee905b));background-image:-webkit-linear-gradient(top,#ee5f5b,#ee905b);background-image:-o-linear-gradient(top,#ee5f5b,#ee905b);background-image:linear-gradient(to bottom,#ee5f5b,#ee905b);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffee5f5b', endColorstr='#ffee905b', GradientType=0);border-color:#ee905b #ee905b #e56218;border-color:rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25);*background-color:#ee905b;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}[date-picker] .now:hover,[date-picker] .now:active,[date-picker] .now.active,[date-picker] .now.disabled,[date-picker] .now[disabled]{color:#fff;background-color:#ee905b;*background-color:#ec8044}[date-picker] .now:active,[date-picker] .now.active{background-color:#e9712d \9}[date-picker] .disabled{background:0;color:#999!important;cursor:default}[date-picker] [ng-switch-when=year] span,[date-picker] [ng-switch-when=month] span,[date-picker] [ng-switch-when=minutes] span{height:54px;line-height:54px}[date-picker] [ng-switch-when=date] td{padding:0}[date-picker] [ng-switch-when=date] span{width:100%;height:26px;line-height:26px}[date-picker] th:hover,[date-picker] [ng-switch-when=date] td span:hover{background:#eee;cursor:pointer} \ No newline at end of file +.clearfix:after,.clearfix:before{display:table;content:"";line-height:0}.clearfix:after{clear:both}.hide-text{font:0/0 a;color:transparent;text-shadow:none;background-color:transparent;border:0}[date-picker],[date-picker] td,[date-picker] th{-webkit-border-radius:4px;-moz-border-radius:4px}.input-block-level{display:block;width:100%;min-height:30px;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.date-picker-date-time{position:absolute}[date-picker-wrapper]{position:absolute;min-width:220px;z-index:10;display:block;font-size:14px}[date-time-append] [date-picker-wrapper] [date-picker]{margin-top:-30px}[date-time-append] [date-picker]{position:relative;margin-right:-1000px;margin-bottom:-1000px}[date-range] [date-picker] .after.before{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,.25);background-color:#499dcd;background-image:-moz-linear-gradient(top,#5bc0de,#2f6ab4);background-image:-webkit-gradient(linear,0 0,0 100%,from(#5bc0de),to(#2f6ab4));background-image:-webkit-linear-gradient(top,#5bc0de,#2f6ab4);background-image:-o-linear-gradient(top,#5bc0de,#2f6ab4);background-image:linear-gradient(to bottom,#5bc0de,#2f6ab4);background-repeat:repeat-x;border-color:#2f6ab4 #2f6ab4 #1f4677;border-color:rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}[date-range] [date-picker] .after.before.active,[date-range] [date-picker] .after.before.disabled,[date-range] [date-picker] .after.before:active,[date-range] [date-picker] .after.before:hover,[date-range] [date-picker] .after.before[disabled]{color:#fff;background-color:#2f6ab4}[date-range] [date-picker] .after.before.active,[date-range] [date-picker] .after.before:active{background-color:#24528c\9}[date-picker].hidden{display:none}[date-picker]{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;-o-user-select:none;user-select:none;border-radius:4px;background-color:#fff;padding:4px}[date-picker] table{margin:0}[date-picker] td,[date-picker] th{padding:4px 5px;text-align:center;width:20px;height:20px;border-radius:4px;border:none}[date-picker] .switch{width:145px}[date-picker] span{display:block;width:23%;height:26px;line-height:25px;float:left;margin:1%;cursor:pointer;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px}[date-picker] span:hover{background:#eee}[date-picker] span.disabled,[date-picker] span.disabled:hover{background:0 0;color:#999;cursor:default}[date-picker] .active,[date-picker] .now{text-shadow:0 -1px 0 rgba(0,0,0,.25);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background-color:#006dcc;background-image:-moz-linear-gradient(top,#08c,#04c);background-image:-webkit-gradient(linear,0 0,0 100%,from(#08c),to(#04c));background-image:-webkit-linear-gradient(top,#08c,#04c);background-image:-o-linear-gradient(top,#08c,#04c);background-image:linear-gradient(to bottom,#08c,#04c);border-color:#04c #04c #002a80;border-color:rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25);color:#fff}[date-picker] .active.active,[date-picker] .active.disabled,[date-picker] .active:active,[date-picker] .active:hover,[date-picker] .active[disabled],[date-picker] .now.active,[date-picker] .now.disabled,[date-picker] .now:active,[date-picker] .now:hover,[date-picker] .now[disabled]{color:#fff;background-color:#04c}[date-picker] .active.active,[date-picker] .active:active,[date-picker] .now.active,[date-picker] .now:active{background-color:#039\9}[date-picker] .now{color:#fff;background-color:#ee735b;background-image:-moz-linear-gradient(top,#ee5f5b,#ee905b);background-image:-webkit-gradient(linear,0 0,0 100%,from(#ee5f5b),to(#ee905b));background-image:-webkit-linear-gradient(top,#ee5f5b,#ee905b);background-image:-o-linear-gradient(top,#ee5f5b,#ee905b);background-image:linear-gradient(to bottom,#ee5f5b,#ee905b);border-color:#ee905b #ee905b #e56218;border-color:rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25)}[date-picker] .now.active,[date-picker] .now.disabled,[date-picker] .now:active,[date-picker] .now:hover,[date-picker] .now[disabled]{color:#fff;background-color:#ee905b}[date-picker] .now.active,[date-picker] .now:active{background-color:#e9712d\9}[date-picker] .disabled{background:0 0;color:#999!important;cursor:default}[date-picker] [ng-switch-when=year] span,[date-picker] [ng-switch-when=month] span,[date-picker] [ng-switch-when=minutes] span{height:54px;line-height:54px}[date-picker] [ng-switch-when=date] td{padding:0}[date-picker] [ng-switch-when=date] span{width:100%;height:26px;line-height:26px}[date-picker] [ng-switch-when=date] td span:hover,[date-picker] th:hover{background:#eee;cursor:pointer} \ No newline at end of file diff --git a/dist/angular-datepicker.min.js b/dist/angular-datepicker.min.js index c33d87c..402db17 100644 --- a/dist/angular-datepicker.min.js +++ b/dist/angular-datepicker.min.js @@ -1 +1 @@ -"use strict";!function(a){var b=a.module("datePicker",[]);b.constant("datePickerConfig",{template:"templates/datepicker.html",view:"month",views:["year","month","date","hours","minutes"],step:5}),b.filter("time",function(){function a(a){return("0"+a.getHours()).slice(-2)+":"+("0"+a.getMinutes()).slice(-2)}return function(b){return b instanceof Date||(b=new Date(b),!isNaN(b.getTime()))?a(b):void 0}}),b.directive("datePicker",["datePickerConfig","datePickerUtils",function(b,c){return{require:"?ngModel",template:'
',scope:{model:"=datePicker",after:"=?",before:"=?"},link:function(d,e,f,g){function h(){var a=d.view;d.model&&!j&&(d.date=new Date(d.model),j=!1);var b=d.date;switch(a){case"year":d.years=c.getVisibleYears(b);break;case"month":d.months=c.getVisibleMonths(b);break;case"date":d.weekdays=d.weekdays||c.getDaysOfWeek(),d.weeks=c.getVisibleWeeks(b);break;case"hours":d.hours=c.getVisibleHours(b);break;case"minutes":d.minutes=c.getVisibleMinutes(b,k)}}function i(){return"date"!==d.view?d.view:d.date?d.date.getMonth():null}var j=!1;d.date=new Date(d.model||new Date),d.views=b.views.concat(),d.view=f.view||b.view,d.now=new Date,d.template=f.template||b.template;var k=parseInt(f.step||b.step,10),l=!!f.partial;if(g){if(a.isDefined(f.minDate)){var m;g.$validators.min=function(b){return!c.isValidDate(b)||a.isUndefined(m)||b>=m},f.$observe("minDate",function(a){m=new Date(a),g.$validate()})}if(a.isDefined(f.maxDate)){var n;g.$validators.max=function(b){return!c.isValidDate(b)||a.isUndefined(n)||n>=b},f.$observe("maxDate",function(a){n=new Date(a),g.$validate()})}}d.views=d.views.slice(d.views.indexOf(f.maxView||"year"),d.views.indexOf(f.minView||"minutes")+1),(1===d.views.length||-1===d.views.indexOf(d.view))&&(d.view=d.views[0]),d.setView=function(a){-1!==d.views.indexOf(a)&&(d.view=a)},d.setDate=function(a){if(!f.disabled){d.date=a;var b=d.views[d.views.indexOf(d.view)+1];if(!b||l||d.model){d.model=new Date(d.model||a),g&&g.$setViewValue(d.date);var c=l?"minutes":d.view;switch(c){case"minutes":d.model.setMinutes(a.getMinutes());case"hours":d.model.setHours(a.getHours());case"date":d.model.setDate(a.getDate());case"month":d.model.setMonth(a.getMonth());case"year":d.model.setFullYear(a.getFullYear())}d.$emit("setDate",d.model,d.view)}b&&d.setView(b),b||"true"!==f.autoClose||(e.addClass("hidden"),d.$emit("hidePicker"))}},d.$watch(i,h),d.next=function(a){var b=d.date;switch(a=a||1,d.view){case"year":case"month":b.setFullYear(b.getFullYear()+a);break;case"date":b.setMonth(b.getMonth()+a);break;case"hours":case"minutes":b.setHours(b.getHours()+a)}j=!0,h()},d.prev=function(a){return d.next(-a||-1)},d.isAfter=function(a){return d.after&&c.isAfter(a,d.after)},d.isBefore=function(a){return d.before&&c.isBefore(a,d.before)},d.isSameMonth=function(a){return c.isSameMonth(d.model,a)},d.isSameYear=function(a){return c.isSameYear(d.model,a)},d.isSameDay=function(a){return c.isSameDay(d.model,a)},d.isSameHour=function(a){return c.isSameHour(d.model,a)},d.isSameMinutes=function(a){return c.isSameMinutes(d.model,a)},d.isNow=function(a){var b=!0,c=d.now;switch(d.view){case"minutes":b&=~~(a.getMinutes()/k)===~~(c.getMinutes()/k);case"hours":b&=a.getHours()===c.getHours();case"date":b&=a.getDate()===c.getDate();case"month":b&=a.getMonth()===c.getMonth();case"year":b&=a.getFullYear()===c.getFullYear()}return b}}}}]),a.module("datePicker").factory("datePickerUtils",function(){var a=function(a,b,c,d,e){return new Date(Date.UTC(0|a,0|b,0|c,0|d,0|e))};return{getVisibleMinutes:function(b,c){b=new Date(b||new Date);var d,e,f=b.getFullYear(),g=b.getMonth(),h=b.getDate(),i=b.getUTCHours(),j=[];for(d=0;60>d;d+=c)e=a(f,g,h,i,d),j.push(e);return j},getVisibleWeeks:function(a){a=new Date(a||new Date);var b=a.getMonth(),c=a.getYear();a.setDate(1),a.setDate(0===a.getDay()?-5:a.getDate()-(a.getDay()-1)),1===a.getDate()&&a.setDate(-6);for(var d,e=[];e.length<6&&!(a.getYear()===c&&a.getMonth()>b);)d=this.getDaysOfWeek(a),e.push(d),a.setDate(a.getDate()+7);return e},getVisibleYears:function(b){b=new Date(b||new Date),b.setFullYear(b.getFullYear()-b.getFullYear()%10);for(var c,d=b.getFullYear(),e=[],f=0;12>f;f++)c=a(d),e.push(c),d++;return e},getDaysOfWeek:function(b){b=new Date(b||new Date),b.setDate(b.getDate()-(b.getDay()-1));for(var c,d=b.getFullYear(),e=b.getMonth(),f=b.getDate(),g=[],h=0;7>h;h++)c=a(d,e,f),g.push(c),f++;return g},getVisibleMonths:function(b){b=new Date(b||new Date);for(var c,d=b.getFullYear(),e=[],f=0;12>f;f++)c=a(d,f,1),e.push(c);return e},getVisibleHours:function(b){b=new Date(b||new Date);var c,d,e=b.getFullYear(),f=b.getMonth(),g=b.getDate(),h=[];for(c=0;24>c;c++)d=a(e,f,g,c),h.push(d);return h},isAfter:function(a,b){return a=void 0!==a?new Date(a):a,b=new Date(b),a&&a.getTime()>=b.getTime()},isBefore:function(a,b){return a=void 0!==a?new Date(a):a,b=new Date(b),a.getTime()<=b.getTime()},isSameYear:function(a,b){return a=void 0!==a?new Date(a):a,b=new Date(b),a&&a.getFullYear()===b.getFullYear()},isSameMonth:function(a,b){return a=void 0!==a?new Date(a):a,b=new Date(b),this.isSameYear(a,b)&&a.getMonth()===b.getMonth()},isSameDay:function(a,b){return a=void 0!==a?new Date(a):a,b=new Date(b),this.isSameMonth(a,b)&&a.getDate()===b.getDate()},isSameHour:function(a,b){return a=void 0!==a?new Date(a):a,b=new Date(b),this.isSameDay(a,b)&&a.getHours()===b.getHours()},isSameMinutes:function(a,b){return a=void 0!==a?new Date(a):a,b=new Date(b),this.isSameHour(a,b)&&a.getMinutes()===b.getMinutes()},isValidDate:function(a){return a&&!(a.getTime&&a.getTime()!==a.getTime())}}});var b=a.module("datePicker");b.directive("dateRange",function(){return{templateUrl:"templates/daterange.html",scope:{start:"=",end:"="},link:function(a,b,c){a.start=new Date(a.start||new Date),a.end=new Date(a.end||new Date),c.$observe("disabled",function(b){a.disableDatePickers=!!b}),a.$watch("start.getTime()",function(b){b&&a.end&&b>a.end.getTime()&&(a.end=new Date(b))}),a.$watch("end.getTime()",function(b){b&&a.start&&b'},format:"yyyy-MM-dd HH:mm",views:["date","year","month","hours","minutes"],autoClose:!1,position:"relative"}),b.directive("dateTimeAppend",function(){return{link:function(a,b){b.bind("click",function(){b.find("input")[0].focus()})}}}),b.directive("dateTime",["$compile","$document","$filter","dateTimeConfig","$parse","datePickerUtils",function(b,e,f,g,h,i){var j=e.find("body"),k=f("date");return{require:"ngModel",scope:!0,link:function(e,f,l,m){function n(a){return k(a,s)}function o(a){return a.length===s.length?a:void 0}function p(a){a.stopPropagation(),m.$pristine&&(m.$dirty=!0,m.$pristine=!1,f.removeClass(c).addClass(d),t&&t.$setDirty(),m.$render())}function q(){y&&(y.remove(),y=null),A&&(A.remove(),A=null)}function r(){if(!y){if(y=b(D)(e),e.$digest(),e.$on("setDate",function(a,b,c){p(a),x&&u[u.length-1]===c&&q()}),e.$on("hidePicker",function(){f.triggerHandler("blur")}),e.$on("$destroy",q),"absolute"===z){var c=a.extend(f.offset(),{height:f[0].offsetHeight});y.css({top:c.top+c.height,left:c.left,display:"block",position:z}),j.append(y)}else A=a.element("
"),f[0].parentElement.insertBefore(A[0],f[0]),A.append(y),y.css({top:f[0].offsetHeight+"px",display:"block"});y.bind("mousedown",function(a){a.preventDefault()})}}var s=l.format||g.format,t=f.inheritedData("$formController"),u=h(l.views)(e)||g.views.concat(),v=l.view||u[0],w=u.indexOf(v),x=l.autoClose?h(l.autoClose)(e):g.autoClose,y=null,z=l.position||g.position,A=null;if(-1===w&&u.splice(w,1),u.unshift(v),m.$formatters.push(n),m.$parsers.unshift(o),a.isDefined(l.minDate)){var B;m.$validators.min=function(b){return!i.isValidDate(b)||a.isUndefined(B)||b>=B},l.$observe("minDate",function(a){B=new Date(a),m.$validate()})}if(a.isDefined(l.maxDate)){var C;m.$validators.max=function(b){return!i.isValidDate(b)||a.isUndefined(C)||C>=b},l.$observe("maxDate",function(a){C=new Date(a),m.$validate()})}var D=g.template(l);f.bind("focus",r),f.bind("blur",q)}}}]),a.module("datePicker").run(["$templateCache",function(a){a.put("templates/datepicker.html",'
\r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n \r\n
\r\n
\r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n \r\n
\r\n
\r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n \r\n
\r\n
\r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n \r\n
\r\n
\r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n \r\n
\r\n
\r\n
\r\n'),a.put("templates/daterange.html",'
\r\n \r\n \r\n \r\n \r\n \r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n')}])}(angular); \ No newline at end of file +"use strict";!function(a){var b=a.module("datePicker",[]);b.constant("datePickerConfig",{template:"templates/datepicker.html",view:"month",views:["year","month","date","hours","minutes"],step:5}),b.filter("time",function(){function a(a){return("0"+a.getHours()).slice(-2)+":"+("0"+a.getMinutes()).slice(-2)}return function(b){return b instanceof Date||(b=new Date(b),!isNaN(b.getTime()))?a(b):void 0}}),b.directive("datePicker",["datePickerConfig","datePickerUtils",function(b,c){return{require:"?ngModel",template:'
',scope:{model:"=datePicker",after:"=?",before:"=?"},link:function(d,e,f,g){function h(){var a=d.view;d.model&&!j&&(d.date=new Date(d.model),j=!1);var b=d.date;switch(a){case"year":d.years=c.getVisibleYears(b);break;case"month":d.months=c.getVisibleMonths(b);break;case"date":d.weekdays=d.weekdays||c.getDaysOfWeek(),d.weeks=c.getVisibleWeeks(b);break;case"hours":d.hours=c.getVisibleHours(b);break;case"minutes":d.minutes=c.getVisibleMinutes(b,k)}}function i(){return"date"!==d.view?d.view:d.date?d.date.getMonth():null}var j=!1;d.date=new Date(d.model||new Date),d.views=b.views.concat(),d.view=f.view||b.view,d.now=new Date,d.template=f.template||b.template;var k=parseInt(f.step||b.step,10),l=!!f.partial;if(g){if(a.isDefined(f.minDate)){var m;g.$validators.min=function(b){return!c.isValidDate(b)||a.isUndefined(m)||b>=m},f.$observe("minDate",function(a){m=new Date(a),g.$validate()})}if(a.isDefined(f.maxDate)){var n;g.$validators.max=function(b){return!c.isValidDate(b)||a.isUndefined(n)||n>=b},f.$observe("maxDate",function(a){n=new Date(a),g.$validate()})}}d.views=d.views.slice(d.views.indexOf(f.maxView||"year"),d.views.indexOf(f.minView||"minutes")+1),(1===d.views.length||-1===d.views.indexOf(d.view))&&(d.view=d.views[0]),d.setView=function(a){-1!==d.views.indexOf(a)&&(d.view=a)},d.setDate=function(a){if(!f.disabled){d.date=a;var b=d.views[d.views.indexOf(d.view)+1];if(!b||l||d.model){d.model=new Date(d.model||a),g&&g.$setViewValue(d.date);var c=l?"minutes":d.view;switch(c){case"minutes":d.model.setMinutes(a.getMinutes());case"hours":d.model.setHours(a.getHours());case"date":d.model.setDate(a.getDate());case"month":d.model.setMonth(a.getMonth());case"year":d.model.setFullYear(a.getFullYear())}d.$emit("setDate",d.model,d.view)}b&&d.setView(b),b||"true"!==f.autoClose||(e.addClass("hidden"),d.$emit("hidePicker"))}},d.$watch(i,h),d.next=function(a){var b=d.date;switch(a=a||1,d.view){case"year":case"month":b.setFullYear(b.getFullYear()+a);break;case"date":b.setMonth(b.getMonth()+a);break;case"hours":case"minutes":b.setHours(b.getHours()+a)}j=!0,h()},d.prev=function(a){return d.next(-a||-1)},d.isAfter=function(a){return d.after&&c.isAfter(a,d.after)},d.isBefore=function(a){return d.before&&c.isBefore(a,d.before)},d.isSameMonth=function(a){return c.isSameMonth(d.model,a)},d.isSameYear=function(a){return c.isSameYear(d.model,a)},d.isSameDay=function(a){return c.isSameDay(d.model,a)},d.isSameHour=function(a){return c.isSameHour(d.model,a)},d.isSameMinutes=function(a){return c.isSameMinutes(d.model,a)},d.isNow=function(a){var b=!0,c=d.now;switch(d.view){case"minutes":b&=~~(a.getMinutes()/k)===~~(c.getMinutes()/k);case"hours":b&=a.getHours()===c.getHours();case"date":b&=a.getDate()===c.getDate();case"month":b&=a.getMonth()===c.getMonth();case"year":b&=a.getFullYear()===c.getFullYear()}return b}}}}]),a.module("datePicker").factory("datePickerUtils",function(){var a=function(a,b,c,d,e){return new Date(0|a,0|b,0|c,0|d,0|e)};return{getVisibleMinutes:function(b,c){b=new Date(b||new Date);var d,e,f=b.getFullYear(),g=b.getMonth(),h=b.getDate(),i=b.getHours(),j=[];for(d=0;60>d;d+=c)e=a(f,g,h,i,d),j.push(e);return j},getVisibleWeeks:function(a){a=new Date(a||new Date);var b=a.getMonth(),c=a.getYear();a.setDate(1),0===a.getDay()?a.setDate(-5):a.setDate(a.getDate()-(a.getDay()-1)),1===a.getDate()&&a.setDate(-6);for(var d,e=[];e.length<6&&!(a.getYear()===c&&a.getMonth()>b);)d=this.getDaysOfWeek(a),e.push(d),a.setDate(a.getDate()+7);return e},getVisibleYears:function(b){b=new Date(b||new Date),b.setFullYear(b.getFullYear()-b.getFullYear()%10);for(var c,d=b.getFullYear(),e=[],f=0;12>f;f++)c=a(d),e.push(c),d++;return e},getDaysOfWeek:function(b){b=new Date(b||new Date),b.setDate(b.getDate()-(b.getDay()-1));for(var c,d=b.getFullYear(),e=b.getMonth(),f=b.getDate(),g=[],h=0;7>h;h++)c=a(d,e,f),g.push(c),f++;return g},getVisibleMonths:function(b){b=new Date(b||new Date);for(var c,d=b.getFullYear(),e=[],f=0;12>f;f++)c=a(d,f,1),e.push(c);return e},getVisibleHours:function(b){b=new Date(b||new Date);var c,d,e=b.getFullYear(),f=b.getMonth(),g=b.getDate(),h=[];for(c=0;24>c;c++)d=a(e,f,g,c),h.push(d);return h},isAfter:function(a,b){return a=void 0!==a?new Date(a):a,b=new Date(b),a&&a.getTime()>=b.getTime()},isBefore:function(a,b){return a=void 0!==a?new Date(a):a,b=new Date(b),a.getTime()<=b.getTime()},isSameYear:function(a,b){return a=void 0!==a?new Date(a):a,b=new Date(b),a&&a.getFullYear()===b.getFullYear()},isSameMonth:function(a,b){return a=void 0!==a?new Date(a):a,b=new Date(b),this.isSameYear(a,b)&&a.getMonth()===b.getMonth()},isSameDay:function(a,b){return a=void 0!==a?new Date(a):a,b=new Date(b),this.isSameMonth(a,b)&&a.getDate()===b.getDate()},isSameHour:function(a,b){return a=void 0!==a?new Date(a):a,b=new Date(b),this.isSameDay(a,b)&&a.getHours()===b.getHours()},isSameMinutes:function(a,b){return a=void 0!==a?new Date(a):a,b=new Date(b),this.isSameHour(a,b)&&a.getMinutes()===b.getMinutes()},isValidDate:function(a){return a&&!(a.getTime&&a.getTime()!==a.getTime())}}});var b=a.module("datePicker");b.directive("dateRange",function(){return{templateUrl:"templates/daterange.html",scope:{start:"=",end:"="},link:function(a,b,c){a.start=new Date(a.start||new Date),a.end=new Date(a.end||new Date),c.$observe("disabled",function(b){a.disableDatePickers=!!b}),a.$watch("start.getTime()",function(b){b&&a.end&&b>a.end.getTime()&&(a.end=new Date(b))}),a.$watch("end.getTime()",function(b){b&&a.start&&b'},format:"yyyy-MM-dd HH:mm",views:["date","year","month","hours","minutes"],autoClose:!1,position:"relative"}),b.directive("dateTimeAppend",function(){return{link:function(a,b){b.bind("click",function(){b.find("input")[0].focus()})}}}),b.directive("dateTime",["$compile","$document","$filter","dateTimeConfig","$parse","datePickerUtils",function(b,e,f,g,h,i){var j=e.find("body"),k=f("date");return{require:"ngModel",scope:!0,link:function(e,f,l,m){function n(a){return k(a,s)}function o(a){return a.length===s.length?a:void 0}function p(a){a.stopPropagation(),m.$pristine&&(m.$dirty=!0,m.$pristine=!1,f.removeClass(c).addClass(d),t&&t.$setDirty(),m.$render())}function q(){y&&(y.remove(),y=null),A&&(A.remove(),A=null)}function r(){if(!y){if(y=b(D)(e),e.$digest(),e.$on("setDate",function(a,b,c){p(a),x&&u[u.length-1]===c&&q()}),e.$on("hidePicker",function(){f.triggerHandler("blur")}),e.$on("$destroy",q),"absolute"===z){var c=a.extend(f.offset(),{height:f[0].offsetHeight});y.css({top:c.top+c.height,left:c.left,display:"block",position:z}),j.append(y)}else A=a.element("
"),f[0].parentElement.insertBefore(A[0],f[0]),A.append(y),y.css({top:f[0].offsetHeight+"px",display:"block"});y.bind("mousedown",function(a){a.preventDefault()})}}var s=l.format||g.format,t=f.inheritedData("$formController"),u=h(l.views)(e)||g.views.concat(),v=l.view||u[0],w=u.indexOf(v),x=l.autoClose?h(l.autoClose)(e):g.autoClose,y=null,z=l.position||g.position,A=null;if(-1===w&&u.splice(w,1),u.unshift(v),m.$formatters.push(n),m.$parsers.unshift(o),a.isDefined(l.minDate)){var B;m.$validators.min=function(b){return!i.isValidDate(b)||a.isUndefined(B)||b>=B},l.$observe("minDate",function(a){B=new Date(a),m.$validate()})}if(a.isDefined(l.maxDate)){var C;m.$validators.max=function(b){return!i.isValidDate(b)||a.isUndefined(C)||C>=b},l.$observe("maxDate",function(a){C=new Date(a),m.$validate()})}var D=g.template(l);f.bind("focus",r),f.bind("blur",q)}}}]),a.module("datePicker").run(["$templateCache",function(a){a.put("app/templates/datepicker.html",'
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n \n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n \n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n \n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n \n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n \n
\n
\n
\n'),a.put("app/templates/daterange.html",'
\n \n \n \n \n \n
\n
\n
\n
\n
\n
\n')}])}(angular); \ No newline at end of file From 374ce13ebee731be1d54f53f80358453ae13ad2e Mon Sep 17 00:00:00 2001 From: santiagovazquez Date: Mon, 5 Oct 2015 18:08:09 -0300 Subject: [PATCH 7/8] Removing moment missing references --- app/index.html | 2 -- karma.conf.js | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/app/index.html b/app/index.html index 4bc03b9..d812d7a 100644 --- a/app/index.html +++ b/app/index.html @@ -170,8 +170,6 @@
Date range button
- - diff --git a/karma.conf.js b/karma.conf.js index 019702c..91474e1 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -4,7 +4,7 @@ module.exports = function (config) { basePath : '', // list of files / patterns to load in the browser - files : [ 'app/components/angular/angular.js', 'app/components/angular-mocks/angular-mocks.js', 'app/components/angular-moment/angular-moment.js', 'app/scripts/*.js', 'app/scripts/**/*.js', 'test/mock/**/*.js', 'test/spec/**/*.js' ], + files : [ 'app/components/angular/angular.js', 'app/components/angular-mocks/angular-mocks.js', 'app/scripts/*.js', 'app/scripts/**/*.js', 'test/mock/**/*.js', 'test/spec/**/*.js' ], // list of files to exclude exclude : [ From 866ef190fed6ec6cf3bfd8f5677ae6873411fff8 Mon Sep 17 00:00:00 2001 From: santiagovazquez Date: Mon, 5 Oct 2015 18:40:24 -0300 Subject: [PATCH 8/8] Replacing template path on dist folder to match js file --- Gruntfile.js | 7 ++++++- dist/angular-datepicker.js | 4 ++-- dist/angular-datepicker.min.js | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 85a3cfd..3127ef9 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -160,10 +160,15 @@ module.exports = function (grunt) { dist: { options: { base: '<%= yeoman.app %>', - module: 'datePicker' + module: 'datePicker', + url: function(templateUrl) { + // on production it should be the same path as the one defined on datePicker.js + return templateUrl.replace('app/', ''); + } }, src: '<%= yeoman.app %>/templates/*.html', dest: '<%= yeoman.tmp %>/templates.js' + } }, concurrent: { diff --git a/dist/angular-datepicker.js b/dist/angular-datepicker.js index 24eba79..6c68729 100644 --- a/dist/angular-datepicker.js +++ b/dist/angular-datepicker.js @@ -647,7 +647,7 @@ Module.directive('dateTime', ['$compile', '$document', '$filter', 'dateTimeConfi }]); angular.module('datePicker').run(['$templateCache', function($templateCache) { -$templateCache.put('app/templates/datepicker.html', +$templateCache.put('templates/datepicker.html', "
\n" + "
\n" + " \n" + @@ -758,7 +758,7 @@ $templateCache.put('app/templates/datepicker.html', ); - $templateCache.put('app/templates/daterange.html', + $templateCache.put('templates/daterange.html', "
\n" + "
\n" + " \n" + diff --git a/dist/angular-datepicker.min.js b/dist/angular-datepicker.min.js index 402db17..ee6d015 100644 --- a/dist/angular-datepicker.min.js +++ b/dist/angular-datepicker.min.js @@ -1 +1 @@ -"use strict";!function(a){var b=a.module("datePicker",[]);b.constant("datePickerConfig",{template:"templates/datepicker.html",view:"month",views:["year","month","date","hours","minutes"],step:5}),b.filter("time",function(){function a(a){return("0"+a.getHours()).slice(-2)+":"+("0"+a.getMinutes()).slice(-2)}return function(b){return b instanceof Date||(b=new Date(b),!isNaN(b.getTime()))?a(b):void 0}}),b.directive("datePicker",["datePickerConfig","datePickerUtils",function(b,c){return{require:"?ngModel",template:'
',scope:{model:"=datePicker",after:"=?",before:"=?"},link:function(d,e,f,g){function h(){var a=d.view;d.model&&!j&&(d.date=new Date(d.model),j=!1);var b=d.date;switch(a){case"year":d.years=c.getVisibleYears(b);break;case"month":d.months=c.getVisibleMonths(b);break;case"date":d.weekdays=d.weekdays||c.getDaysOfWeek(),d.weeks=c.getVisibleWeeks(b);break;case"hours":d.hours=c.getVisibleHours(b);break;case"minutes":d.minutes=c.getVisibleMinutes(b,k)}}function i(){return"date"!==d.view?d.view:d.date?d.date.getMonth():null}var j=!1;d.date=new Date(d.model||new Date),d.views=b.views.concat(),d.view=f.view||b.view,d.now=new Date,d.template=f.template||b.template;var k=parseInt(f.step||b.step,10),l=!!f.partial;if(g){if(a.isDefined(f.minDate)){var m;g.$validators.min=function(b){return!c.isValidDate(b)||a.isUndefined(m)||b>=m},f.$observe("minDate",function(a){m=new Date(a),g.$validate()})}if(a.isDefined(f.maxDate)){var n;g.$validators.max=function(b){return!c.isValidDate(b)||a.isUndefined(n)||n>=b},f.$observe("maxDate",function(a){n=new Date(a),g.$validate()})}}d.views=d.views.slice(d.views.indexOf(f.maxView||"year"),d.views.indexOf(f.minView||"minutes")+1),(1===d.views.length||-1===d.views.indexOf(d.view))&&(d.view=d.views[0]),d.setView=function(a){-1!==d.views.indexOf(a)&&(d.view=a)},d.setDate=function(a){if(!f.disabled){d.date=a;var b=d.views[d.views.indexOf(d.view)+1];if(!b||l||d.model){d.model=new Date(d.model||a),g&&g.$setViewValue(d.date);var c=l?"minutes":d.view;switch(c){case"minutes":d.model.setMinutes(a.getMinutes());case"hours":d.model.setHours(a.getHours());case"date":d.model.setDate(a.getDate());case"month":d.model.setMonth(a.getMonth());case"year":d.model.setFullYear(a.getFullYear())}d.$emit("setDate",d.model,d.view)}b&&d.setView(b),b||"true"!==f.autoClose||(e.addClass("hidden"),d.$emit("hidePicker"))}},d.$watch(i,h),d.next=function(a){var b=d.date;switch(a=a||1,d.view){case"year":case"month":b.setFullYear(b.getFullYear()+a);break;case"date":b.setMonth(b.getMonth()+a);break;case"hours":case"minutes":b.setHours(b.getHours()+a)}j=!0,h()},d.prev=function(a){return d.next(-a||-1)},d.isAfter=function(a){return d.after&&c.isAfter(a,d.after)},d.isBefore=function(a){return d.before&&c.isBefore(a,d.before)},d.isSameMonth=function(a){return c.isSameMonth(d.model,a)},d.isSameYear=function(a){return c.isSameYear(d.model,a)},d.isSameDay=function(a){return c.isSameDay(d.model,a)},d.isSameHour=function(a){return c.isSameHour(d.model,a)},d.isSameMinutes=function(a){return c.isSameMinutes(d.model,a)},d.isNow=function(a){var b=!0,c=d.now;switch(d.view){case"minutes":b&=~~(a.getMinutes()/k)===~~(c.getMinutes()/k);case"hours":b&=a.getHours()===c.getHours();case"date":b&=a.getDate()===c.getDate();case"month":b&=a.getMonth()===c.getMonth();case"year":b&=a.getFullYear()===c.getFullYear()}return b}}}}]),a.module("datePicker").factory("datePickerUtils",function(){var a=function(a,b,c,d,e){return new Date(0|a,0|b,0|c,0|d,0|e)};return{getVisibleMinutes:function(b,c){b=new Date(b||new Date);var d,e,f=b.getFullYear(),g=b.getMonth(),h=b.getDate(),i=b.getHours(),j=[];for(d=0;60>d;d+=c)e=a(f,g,h,i,d),j.push(e);return j},getVisibleWeeks:function(a){a=new Date(a||new Date);var b=a.getMonth(),c=a.getYear();a.setDate(1),0===a.getDay()?a.setDate(-5):a.setDate(a.getDate()-(a.getDay()-1)),1===a.getDate()&&a.setDate(-6);for(var d,e=[];e.length<6&&!(a.getYear()===c&&a.getMonth()>b);)d=this.getDaysOfWeek(a),e.push(d),a.setDate(a.getDate()+7);return e},getVisibleYears:function(b){b=new Date(b||new Date),b.setFullYear(b.getFullYear()-b.getFullYear()%10);for(var c,d=b.getFullYear(),e=[],f=0;12>f;f++)c=a(d),e.push(c),d++;return e},getDaysOfWeek:function(b){b=new Date(b||new Date),b.setDate(b.getDate()-(b.getDay()-1));for(var c,d=b.getFullYear(),e=b.getMonth(),f=b.getDate(),g=[],h=0;7>h;h++)c=a(d,e,f),g.push(c),f++;return g},getVisibleMonths:function(b){b=new Date(b||new Date);for(var c,d=b.getFullYear(),e=[],f=0;12>f;f++)c=a(d,f,1),e.push(c);return e},getVisibleHours:function(b){b=new Date(b||new Date);var c,d,e=b.getFullYear(),f=b.getMonth(),g=b.getDate(),h=[];for(c=0;24>c;c++)d=a(e,f,g,c),h.push(d);return h},isAfter:function(a,b){return a=void 0!==a?new Date(a):a,b=new Date(b),a&&a.getTime()>=b.getTime()},isBefore:function(a,b){return a=void 0!==a?new Date(a):a,b=new Date(b),a.getTime()<=b.getTime()},isSameYear:function(a,b){return a=void 0!==a?new Date(a):a,b=new Date(b),a&&a.getFullYear()===b.getFullYear()},isSameMonth:function(a,b){return a=void 0!==a?new Date(a):a,b=new Date(b),this.isSameYear(a,b)&&a.getMonth()===b.getMonth()},isSameDay:function(a,b){return a=void 0!==a?new Date(a):a,b=new Date(b),this.isSameMonth(a,b)&&a.getDate()===b.getDate()},isSameHour:function(a,b){return a=void 0!==a?new Date(a):a,b=new Date(b),this.isSameDay(a,b)&&a.getHours()===b.getHours()},isSameMinutes:function(a,b){return a=void 0!==a?new Date(a):a,b=new Date(b),this.isSameHour(a,b)&&a.getMinutes()===b.getMinutes()},isValidDate:function(a){return a&&!(a.getTime&&a.getTime()!==a.getTime())}}});var b=a.module("datePicker");b.directive("dateRange",function(){return{templateUrl:"templates/daterange.html",scope:{start:"=",end:"="},link:function(a,b,c){a.start=new Date(a.start||new Date),a.end=new Date(a.end||new Date),c.$observe("disabled",function(b){a.disableDatePickers=!!b}),a.$watch("start.getTime()",function(b){b&&a.end&&b>a.end.getTime()&&(a.end=new Date(b))}),a.$watch("end.getTime()",function(b){b&&a.start&&b'},format:"yyyy-MM-dd HH:mm",views:["date","year","month","hours","minutes"],autoClose:!1,position:"relative"}),b.directive("dateTimeAppend",function(){return{link:function(a,b){b.bind("click",function(){b.find("input")[0].focus()})}}}),b.directive("dateTime",["$compile","$document","$filter","dateTimeConfig","$parse","datePickerUtils",function(b,e,f,g,h,i){var j=e.find("body"),k=f("date");return{require:"ngModel",scope:!0,link:function(e,f,l,m){function n(a){return k(a,s)}function o(a){return a.length===s.length?a:void 0}function p(a){a.stopPropagation(),m.$pristine&&(m.$dirty=!0,m.$pristine=!1,f.removeClass(c).addClass(d),t&&t.$setDirty(),m.$render())}function q(){y&&(y.remove(),y=null),A&&(A.remove(),A=null)}function r(){if(!y){if(y=b(D)(e),e.$digest(),e.$on("setDate",function(a,b,c){p(a),x&&u[u.length-1]===c&&q()}),e.$on("hidePicker",function(){f.triggerHandler("blur")}),e.$on("$destroy",q),"absolute"===z){var c=a.extend(f.offset(),{height:f[0].offsetHeight});y.css({top:c.top+c.height,left:c.left,display:"block",position:z}),j.append(y)}else A=a.element("
"),f[0].parentElement.insertBefore(A[0],f[0]),A.append(y),y.css({top:f[0].offsetHeight+"px",display:"block"});y.bind("mousedown",function(a){a.preventDefault()})}}var s=l.format||g.format,t=f.inheritedData("$formController"),u=h(l.views)(e)||g.views.concat(),v=l.view||u[0],w=u.indexOf(v),x=l.autoClose?h(l.autoClose)(e):g.autoClose,y=null,z=l.position||g.position,A=null;if(-1===w&&u.splice(w,1),u.unshift(v),m.$formatters.push(n),m.$parsers.unshift(o),a.isDefined(l.minDate)){var B;m.$validators.min=function(b){return!i.isValidDate(b)||a.isUndefined(B)||b>=B},l.$observe("minDate",function(a){B=new Date(a),m.$validate()})}if(a.isDefined(l.maxDate)){var C;m.$validators.max=function(b){return!i.isValidDate(b)||a.isUndefined(C)||C>=b},l.$observe("maxDate",function(a){C=new Date(a),m.$validate()})}var D=g.template(l);f.bind("focus",r),f.bind("blur",q)}}}]),a.module("datePicker").run(["$templateCache",function(a){a.put("app/templates/datepicker.html",'
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n \n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n \n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n \n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n \n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n \n
\n
\n
\n'),a.put("app/templates/daterange.html",'
\n \n \n \n \n \n
\n
\n
\n
\n
\n
\n')}])}(angular); \ No newline at end of file +"use strict";!function(a){var b=a.module("datePicker",[]);b.constant("datePickerConfig",{template:"templates/datepicker.html",view:"month",views:["year","month","date","hours","minutes"],step:5}),b.filter("time",function(){function a(a){return("0"+a.getHours()).slice(-2)+":"+("0"+a.getMinutes()).slice(-2)}return function(b){return b instanceof Date||(b=new Date(b),!isNaN(b.getTime()))?a(b):void 0}}),b.directive("datePicker",["datePickerConfig","datePickerUtils",function(b,c){return{require:"?ngModel",template:'
',scope:{model:"=datePicker",after:"=?",before:"=?"},link:function(d,e,f,g){function h(){var a=d.view;d.model&&!j&&(d.date=new Date(d.model),j=!1);var b=d.date;switch(a){case"year":d.years=c.getVisibleYears(b);break;case"month":d.months=c.getVisibleMonths(b);break;case"date":d.weekdays=d.weekdays||c.getDaysOfWeek(),d.weeks=c.getVisibleWeeks(b);break;case"hours":d.hours=c.getVisibleHours(b);break;case"minutes":d.minutes=c.getVisibleMinutes(b,k)}}function i(){return"date"!==d.view?d.view:d.date?d.date.getMonth():null}var j=!1;d.date=new Date(d.model||new Date),d.views=b.views.concat(),d.view=f.view||b.view,d.now=new Date,d.template=f.template||b.template;var k=parseInt(f.step||b.step,10),l=!!f.partial;if(g){if(a.isDefined(f.minDate)){var m;g.$validators.min=function(b){return!c.isValidDate(b)||a.isUndefined(m)||b>=m},f.$observe("minDate",function(a){m=new Date(a),g.$validate()})}if(a.isDefined(f.maxDate)){var n;g.$validators.max=function(b){return!c.isValidDate(b)||a.isUndefined(n)||n>=b},f.$observe("maxDate",function(a){n=new Date(a),g.$validate()})}}d.views=d.views.slice(d.views.indexOf(f.maxView||"year"),d.views.indexOf(f.minView||"minutes")+1),(1===d.views.length||-1===d.views.indexOf(d.view))&&(d.view=d.views[0]),d.setView=function(a){-1!==d.views.indexOf(a)&&(d.view=a)},d.setDate=function(a){if(!f.disabled){d.date=a;var b=d.views[d.views.indexOf(d.view)+1];if(!b||l||d.model){d.model=new Date(d.model||a),g&&g.$setViewValue(d.date);var c=l?"minutes":d.view;switch(c){case"minutes":d.model.setMinutes(a.getMinutes());case"hours":d.model.setHours(a.getHours());case"date":d.model.setDate(a.getDate());case"month":d.model.setMonth(a.getMonth());case"year":d.model.setFullYear(a.getFullYear())}d.$emit("setDate",d.model,d.view)}b&&d.setView(b),b||"true"!==f.autoClose||(e.addClass("hidden"),d.$emit("hidePicker"))}},d.$watch(i,h),d.next=function(a){var b=d.date;switch(a=a||1,d.view){case"year":case"month":b.setFullYear(b.getFullYear()+a);break;case"date":b.setMonth(b.getMonth()+a);break;case"hours":case"minutes":b.setHours(b.getHours()+a)}j=!0,h()},d.prev=function(a){return d.next(-a||-1)},d.isAfter=function(a){return d.after&&c.isAfter(a,d.after)},d.isBefore=function(a){return d.before&&c.isBefore(a,d.before)},d.isSameMonth=function(a){return c.isSameMonth(d.model,a)},d.isSameYear=function(a){return c.isSameYear(d.model,a)},d.isSameDay=function(a){return c.isSameDay(d.model,a)},d.isSameHour=function(a){return c.isSameHour(d.model,a)},d.isSameMinutes=function(a){return c.isSameMinutes(d.model,a)},d.isNow=function(a){var b=!0,c=d.now;switch(d.view){case"minutes":b&=~~(a.getMinutes()/k)===~~(c.getMinutes()/k);case"hours":b&=a.getHours()===c.getHours();case"date":b&=a.getDate()===c.getDate();case"month":b&=a.getMonth()===c.getMonth();case"year":b&=a.getFullYear()===c.getFullYear()}return b}}}}]),a.module("datePicker").factory("datePickerUtils",function(){var a=function(a,b,c,d,e){return new Date(0|a,0|b,0|c,0|d,0|e)};return{getVisibleMinutes:function(b,c){b=new Date(b||new Date);var d,e,f=b.getFullYear(),g=b.getMonth(),h=b.getDate(),i=b.getHours(),j=[];for(d=0;60>d;d+=c)e=a(f,g,h,i,d),j.push(e);return j},getVisibleWeeks:function(a){a=new Date(a||new Date);var b=a.getMonth(),c=a.getYear();a.setDate(1),0===a.getDay()?a.setDate(-5):a.setDate(a.getDate()-(a.getDay()-1)),1===a.getDate()&&a.setDate(-6);for(var d,e=[];e.length<6&&!(a.getYear()===c&&a.getMonth()>b);)d=this.getDaysOfWeek(a),e.push(d),a.setDate(a.getDate()+7);return e},getVisibleYears:function(b){b=new Date(b||new Date),b.setFullYear(b.getFullYear()-b.getFullYear()%10);for(var c,d=b.getFullYear(),e=[],f=0;12>f;f++)c=a(d),e.push(c),d++;return e},getDaysOfWeek:function(b){b=new Date(b||new Date),b.setDate(b.getDate()-(b.getDay()-1));for(var c,d=b.getFullYear(),e=b.getMonth(),f=b.getDate(),g=[],h=0;7>h;h++)c=a(d,e,f),g.push(c),f++;return g},getVisibleMonths:function(b){b=new Date(b||new Date);for(var c,d=b.getFullYear(),e=[],f=0;12>f;f++)c=a(d,f,1),e.push(c);return e},getVisibleHours:function(b){b=new Date(b||new Date);var c,d,e=b.getFullYear(),f=b.getMonth(),g=b.getDate(),h=[];for(c=0;24>c;c++)d=a(e,f,g,c),h.push(d);return h},isAfter:function(a,b){return a=void 0!==a?new Date(a):a,b=new Date(b),a&&a.getTime()>=b.getTime()},isBefore:function(a,b){return a=void 0!==a?new Date(a):a,b=new Date(b),a.getTime()<=b.getTime()},isSameYear:function(a,b){return a=void 0!==a?new Date(a):a,b=new Date(b),a&&a.getFullYear()===b.getFullYear()},isSameMonth:function(a,b){return a=void 0!==a?new Date(a):a,b=new Date(b),this.isSameYear(a,b)&&a.getMonth()===b.getMonth()},isSameDay:function(a,b){return a=void 0!==a?new Date(a):a,b=new Date(b),this.isSameMonth(a,b)&&a.getDate()===b.getDate()},isSameHour:function(a,b){return a=void 0!==a?new Date(a):a,b=new Date(b),this.isSameDay(a,b)&&a.getHours()===b.getHours()},isSameMinutes:function(a,b){return a=void 0!==a?new Date(a):a,b=new Date(b),this.isSameHour(a,b)&&a.getMinutes()===b.getMinutes()},isValidDate:function(a){return a&&!(a.getTime&&a.getTime()!==a.getTime())}}});var b=a.module("datePicker");b.directive("dateRange",function(){return{templateUrl:"templates/daterange.html",scope:{start:"=",end:"="},link:function(a,b,c){a.start=new Date(a.start||new Date),a.end=new Date(a.end||new Date),c.$observe("disabled",function(b){a.disableDatePickers=!!b}),a.$watch("start.getTime()",function(b){b&&a.end&&b>a.end.getTime()&&(a.end=new Date(b))}),a.$watch("end.getTime()",function(b){b&&a.start&&b'},format:"yyyy-MM-dd HH:mm",views:["date","year","month","hours","minutes"],autoClose:!1,position:"relative"}),b.directive("dateTimeAppend",function(){return{link:function(a,b){b.bind("click",function(){b.find("input")[0].focus()})}}}),b.directive("dateTime",["$compile","$document","$filter","dateTimeConfig","$parse","datePickerUtils",function(b,e,f,g,h,i){var j=e.find("body"),k=f("date");return{require:"ngModel",scope:!0,link:function(e,f,l,m){function n(a){return k(a,s)}function o(a){return a.length===s.length?a:void 0}function p(a){a.stopPropagation(),m.$pristine&&(m.$dirty=!0,m.$pristine=!1,f.removeClass(c).addClass(d),t&&t.$setDirty(),m.$render())}function q(){y&&(y.remove(),y=null),A&&(A.remove(),A=null)}function r(){if(!y){if(y=b(D)(e),e.$digest(),e.$on("setDate",function(a,b,c){p(a),x&&u[u.length-1]===c&&q()}),e.$on("hidePicker",function(){f.triggerHandler("blur")}),e.$on("$destroy",q),"absolute"===z){var c=a.extend(f.offset(),{height:f[0].offsetHeight});y.css({top:c.top+c.height,left:c.left,display:"block",position:z}),j.append(y)}else A=a.element("
"),f[0].parentElement.insertBefore(A[0],f[0]),A.append(y),y.css({top:f[0].offsetHeight+"px",display:"block"});y.bind("mousedown",function(a){a.preventDefault()})}}var s=l.format||g.format,t=f.inheritedData("$formController"),u=h(l.views)(e)||g.views.concat(),v=l.view||u[0],w=u.indexOf(v),x=l.autoClose?h(l.autoClose)(e):g.autoClose,y=null,z=l.position||g.position,A=null;if(-1===w&&u.splice(w,1),u.unshift(v),m.$formatters.push(n),m.$parsers.unshift(o),a.isDefined(l.minDate)){var B;m.$validators.min=function(b){return!i.isValidDate(b)||a.isUndefined(B)||b>=B},l.$observe("minDate",function(a){B=new Date(a),m.$validate()})}if(a.isDefined(l.maxDate)){var C;m.$validators.max=function(b){return!i.isValidDate(b)||a.isUndefined(C)||C>=b},l.$observe("maxDate",function(a){C=new Date(a),m.$validate()})}var D=g.template(l);f.bind("focus",r),f.bind("blur",q)}}}]),a.module("datePicker").run(["$templateCache",function(a){a.put("templates/datepicker.html",'
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n \n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n \n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n \n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n \n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n \n
\n
\n
\n'),a.put("templates/daterange.html",'
\n \n \n \n \n \n
\n
\n
\n
\n
\n
\n')}])}(angular); \ No newline at end of file