Reputation: 5
My question is simple.
jQuery('#from').val(jQuery('#to').val());
I want to set the jQuery('#from')
value to jQuery('#to')
- 28 days.
For now, the format of date is mm/dd/yyyy
ex) 04/21/2014
jQuery('#to').val()
is 04/21/2014
what function should I use to calculate the date?
Upvotes: 0
Views: 3088
Reputation: 12847
use good old js:
var fromDate = new Date($('#from').val() );
var toDate = new Date();
toDate.setDate(fromDate.getDate() - 28);
$('#to').val(toDate.toString())
Upvotes: 4