Skip to content

Commit

Permalink
trying to fix #1
Browse files Browse the repository at this point in the history
  • Loading branch information
kapcom01 committed Jun 1, 2014
1 parent e3cb716 commit a6268c1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
9 changes: 9 additions & 0 deletions .cordova/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"lib": {
"www": {
"id": "com.kapjep.love",
"version": "3.4.0",
"uri": "https://github.com/phonegap/phonegap-app-hello-world/archive/3.4.0.tar.gz"
}
}
}
8 changes: 4 additions & 4 deletions www/js/love.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@ function setTitleColor(days){

function showDays() {
if (typeof (Storage) !== "undefined") {
if (!localStorage.lasttime) {
if (!window.localStorage.getItem("lasttime")) {
// if lasttime key is empty then set to today
localStorage.lasttime = Date();
window.localStorage.setItem("lasttime" , Date());
}
var lasttime = new Date(localStorage.lasttime);
var lasttime = new Date(window.localStorage.getItem("lasttime"));
var today = new Date();
var _day = 24 * 3600 * 1000;
var daysDiff = Math.floor(today / _day) - Math.floor(lasttime / _day);
Expand All @@ -74,7 +74,7 @@ function showDays() {
function setToday() {
window.alert("Your last time is set to Today!");
if(typeof(Storage)!=="undefined") {
localStorage.lasttime=Date();
window.localStorage.setItem("lasttime" , Date());
showDays();
}
}

0 comments on commit a6268c1

Please sign in to comment.