Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
date (0 days in the past equals today, 1 day in the past equals yesterday, 2 days in the past equals the day before yesterday, etc.). In this context, the this keyword will contain a reference to the object that was the target of the click event. On this line, I create a new JavaScript date object and store it in a variable named date . Initially, this date will be pointed at the particular moment in time that it was created, so on the next line, I subtract the dayOffset from the result of the getDate() function, and then use setDate() to repoint the date. Here, I build a MM/DD/YYYY-formatted date string and save it to sessionStorage as currentDate . The getMonth() method of the date object returns values from 011, January being 0. Therefore, I have to add 1 to it to generate the correct value for the formatted string. Finally, I call the refreshEntries() function. The job of the refreshEntries() func- tion is to update the incoming Date panel appropriately based on the date that was