refactoring: simplify logic

* avoid chained if-else with one variable
* convert dateformat to constant