working with dates and functions applicationjs