add ensure string for integer and refactor out commont cal timestmap code