Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $(document).ready(function(){
- var today = new Date();
- format = function(date){
- var day = ('0' + date.getDate()).slice(-2);
- var month = ('0' + (date.getMonth() + 1)).slice(-2);
- var year = date.getFullYear();
- return (year + '-' + month + '-' + day);
- }
- $('#checkout').val(format(today));
- $('#checkin').val(format(today));
- $('#minusWeek').click(function(){
- var lastWeek = new Date();
- lastWeek.setDate(lastWeek.getDate() - 7);
- $('#checkin').val(format(lastWeek));
- });
- $('#minusMonth').click(function(){
- var lastMonth = new Date();
- lastMonth.setMonth(lastMonth.getMonth() - 1);
- $('#checkin').val(format(lastMonth));
- });
- $('#view').click(function(){
- alert('Start: ' + $('#checkin').val() + "\n" + 'End: ' + $('#checkout').val());
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement