improved getDateUnit and getDateFmt functions to handle non-date indexes