Skip to content
This repository has been archived by the owner on Sep 12, 2024. It is now read-only.

Commit

Permalink
Version 0.0.5
Browse files Browse the repository at this point in the history
  • Loading branch information
petethepig committed Dec 21, 2015
1 parent 0f7170d commit f1b0109
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 16 deletions.
2 changes: 1 addition & 1 deletion dist/daterangepicker.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!
* knockout-daterangepicker
* version: 0.0.4
* version: 0.0.5
* authors: Sensor Tower team
* license: MIT
* https://sensortower.github.io/daterangepicker
Expand Down
30 changes: 19 additions & 11 deletions dist/daterangepicker.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!
* knockout-daterangepicker
* version: 0.0.4
* version: 0.0.5
* authors: Sensor Tower team
* license: MIT
* https://sensortower.github.io/daterangepicker
Expand All @@ -20,6 +20,7 @@

MomentUtil.setFirstDayOfTheWeek = function(dow) {
var offset;
dow = (dow % 7 + 7) % 7;
if (moment.localeData().firstDayOfWeek() !== dow) {
offset = dow - moment.localeData().firstDayOfWeek();
return this.patchCurrentLocale({
Expand Down Expand Up @@ -429,7 +430,7 @@
};

Config.prototype._dateObservable = function(val, mode, minBoundary, maxBoundary) {
var computed, observable;
var computed, fitMax, fitMin, observable;
observable = ko.observable();
computed = ko.computed({
read: function() {
Expand All @@ -447,21 +448,26 @@
})(this)
});
computed.mode = mode || 'inclusive';
computed.fit = (function(_this) {
fitMin = (function(_this) {
return function(val) {
var max, min;
val = MomentUtil.tz(val, _this.timeZone());
var min;
if (minBoundary) {
min = minBoundary();
switch (minBoundary.mode) {
case 'extended':
min = min.clone().startOf(_this.period());
break;
case 'exclusive':
min = min.clone().endOf(_this.period()).subtract(1, 'millisecond');
min = min.clone().endOf(_this.period()).add(1, 'millisecond');
}
val = moment.max(min, val);
}
return val;
};
})(this);
fitMax = (function(_this) {
return function(val) {
var max;
if (maxBoundary) {
max = maxBoundary();
switch (maxBoundary.mode) {
Expand All @@ -476,6 +482,12 @@
return val;
};
})(this);
computed.fit = (function(_this) {
return function(val) {
val = MomentUtil.tz(val, _this.timeZone());
return fitMax(fitMin(val));
};
})(this);
computed(val);
computed.clone = (function(_this) {
return function() {
Expand Down Expand Up @@ -525,11 +537,7 @@
};

Config.prototype._parentElement = function(val) {
if (this.standalone()) {
return this.anchorElement;
} else {
return $(val || 'body');
}
return $(val || (this.standalone() ? this.anchorElement : 'body'));
};

Config.prototype._callback = function(val) {
Expand Down
2 changes: 1 addition & 1 deletion dist/daterangepicker.min.css

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

Loading

0 comments on commit f1b0109

Please sign in to comment.