use DDG.getDateFromString() instead of if-else block