work correctly even the last day of the month