improve lastDay in getGraphData function