simplify date saving logic
use strict and jshint cleanup