Permalink
Browse files

user format utilized in endTime computation, some whitespace adjustments

  • Loading branch information...
1 parent 654c7fe commit ef86b69a6d6157cf660a34ff45f62c6df1a64d4d @mattneary mattneary committed Dec 2, 2013
Showing with 9 additions and 8 deletions.
  1. +1 −1 index.html
  2. +8 −7 js/jquery.countdown.js
View
@@ -10,7 +10,7 @@
$(".digits").countdown({
image: "img/digits.png",
format: "dd:hh:mm:ss",
- endTime: new Date(2013, 12, 25)
+ endTime: new Date(2013, 12, 2)
});
});
</script>
View
@@ -133,11 +133,11 @@ var moveDigit = function(elem, options) {
// ... precision is the same as the format.
var parseRelativeDate = function(form, options) {
// give the date the values of now by default
- var now = new Date();
- var d = now.getDate();
- var m = now.getMonth() + 1;
- var y = now.getFullYear();
- var h = now.getHours(), mm, s;
+ var now = new Date();
+ var d = now.getDate();
+ var m = now.getMonth() + 1;
+ var y = now.getFullYear();
+ var h = now.getHours(), mm, s;
// read in components and render based on format
var format = options.format;
@@ -201,15 +201,16 @@ jQuery.fn.countdown = function(userOptions) {
image: "digits.png",
continuous: false
};
+ $.extend(options, userOptions);
// if an endTime is provided...
if( userOptions.endTime ) {
// calculate the difference between endTime and present time
var endDate = userOptions.endTime instanceof Date ? userOptions.endTime : parseRelativeDate(userOptions.endTime, options);
- var diff = endDate.getTime() - (new Date()).getTime();
+ var diff = endDate.getTime() - (new Date()).getTime();
// and set that as the startTime
userOptions.startTime = formatCompute(new Date(diff), options);
- delete userOptions.endTime;
+ delete userOptions.endTime;
}
$.extend(options, userOptions);
createDigits(this, options);

0 comments on commit ef86b69

Please sign in to comment.