Mercurial > snowl
changeset 327:3a8dfaf1ac31
correctly calculate the date representing tomorrow
author | Myk Melez <myk@mozilla.org> |
---|---|
date | Thu, 16 Oct 2008 16:37:38 -0700 |
parents | 8ef75b54e3dd |
children | 081793c751c5 |
files | modules/utils.js |
diffstat | 1 files changed, 4 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/modules/utils.js Wed Oct 15 16:40:35 2008 -0700 +++ b/modules/utils.js Thu Oct 16 16:37:38 2008 -0700 @@ -88,7 +88,10 @@ // these calculations to be incorrect at times. get tomorrow() { - let sometimeTomorrow = new Date(new Date() + (1000 * 60 * 60 * 24)); + // We can't just add the right number of milliseconds to new Date() here + // because JavaScript will interpret the plus sign as string concatenation, + // so we have to explicitly call getTime() on the date object. + let sometimeTomorrow = new Date(new Date().getTime() + (1000 * 60 * 60 * 24)); return new Date(sometimeTomorrow.getFullYear(), sometimeTomorrow.getMonth(), sometimeTomorrow.getDate());