Have you considered using `moment` to do this for you?