buildTime function returns empty string when no valid time passed