Skip to content
Browse files

day example

  • Loading branch information...
1 parent 446f5dd commit 654c7fe5d0a09a23aad3dbffd20a824b29f3983b @mattneary mattneary committed
Showing with 6 additions and 6 deletions.
  1. +1 −1 css/media.css
  2. +2 −2 index.html
  3. +3 −3 js/jquery.countdown.js
View
2 css/media.css
@@ -15,7 +15,7 @@ html, body, .wrapper {
}
#holder {
- width: 503px;
+ width: 603px;
height: 383px;
margin: auto;
}
View
4 index.html
@@ -9,8 +9,8 @@
$(function(){
$(".digits").countdown({
image: "img/digits.png",
- format: "hh:mm:ss",
- endTime: '04:50:00'
+ format: "dd:hh:mm:ss",
+ endTime: new Date(2013, 12, 25)
});
});
</script>
View
6 js/jquery.countdown.js
@@ -131,7 +131,7 @@ var moveDigit = function(elem, options) {
// parses a date of the form hh:mm:ss, for example, where
// ... precision is the same as the format.
-var parseRelativeDate = function(form) {
+var parseRelativeDate = function(form, options) {
// give the date the values of now by default
var now = new Date();
var d = now.getDate();
@@ -140,7 +140,7 @@ var parseRelativeDate = function(form) {
var h = now.getHours(), mm, s;
// read in components and render based on format
- var format = userOptions.format||options.format;
+ var format = options.format;
var parts = form.split(':');
if( format.indexOf('dd') == 0 ) {
d = parts[0];
@@ -205,7 +205,7 @@ jQuery.fn.countdown = function(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);
+ var endDate = userOptions.endTime instanceof Date ? userOptions.endTime : parseRelativeDate(userOptions.endTime, options);
var diff = endDate.getTime() - (new Date()).getTime();
// and set that as the startTime
userOptions.startTime = formatCompute(new Date(diff), options);

0 comments on commit 654c7fe

Please sign in to comment.
Something went wrong with that request. Please try again.