Optimize calculation to not create a calendar instance when not needed