fix: infinite recursive loop in getLastDate() under specific conditions

Signed-off-by: Stephen L. <lrq3000@gmail.com>