Fix wrong date formatting when buttons were used