For my website I need to calculate the number of days between the current date and the previous (so not next) socalled billingdate (a fixed annual date (e.g., fixed day and month) on which the bill is sent to the customer) in javascript. The billingdate retrieved from the database is a string, of which year value is not relevant. Also note that in the example below the month-day of the billing date is before the month-day of the current date, but it's also possible that its after the current date
So I have:
var nrofdays; //since last billing date
var currentdate = new Date();
var billingdate = '2010-06-23'; //year value is is not relevant
I'm familiar with the methods of Date, but I still struggle to code this in an elegant way. Any suggestions?