fix datetime format from template, add unit test