[IMP] Improve code of calculation of date