Nevermind - I figured it out.  this is what ended up working (thanks to 
your comment about the months)

/*\
title: $:/inmysocks/macros/day-diff2.js
type: application/javascript
module-type: macro

Takes two dates and returns their difference in days

\*/
(function(){

/*jslint node: true, browser: true */
/*global $tw: false */
"use strict";

/*
Information about this macro
*/

exports.name = "day-diff2";

exports.params = [
{name: "duedate"}
];

/*
Run the macro
*/
exports.run = function(duedate) {
//Make each date object.
var date1 = new Date();
var d = duedate;
var year = d.substring(0, 4);
var month = d.substring(4, 6);
var month2 = month - 1;
var day = d.substring(6, 8);
var date2 = new Date(year, month2, day);



//Find difference in milliseconds.
var elapsed = date2.getTime()-date1.getTime();

//Number of milliseconds in a day.
var dayMS = 86400000; 

//Convert milliseconds to year months and days
var days_diff = Math.floor(elapsed/dayMS);
var result = days_diff;

return result;
};

})();


-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/53c3e0b5-6f2d-4f6b-81f2-91c5abaaa7e0%40googlegroups.com.

Reply via email to