diff --git a/FrontendWebApi/ApiControllers/HydroMeterController.cs b/FrontendWebApi/ApiControllers/HydroMeterController.cs index f87c8f9..b9d840d 100644 --- a/FrontendWebApi/ApiControllers/HydroMeterController.cs +++ b/FrontendWebApi/ApiControllers/HydroMeterController.cs @@ -67,11 +67,7 @@ namespace FrontendWebApi.ApiControllers ? input.startTime + "-01" : input.tableType == "month" || input.tableType == "year" ? input.startTime + "-01-01" : null; - var endTime = input.tableType == "day" || input.tableType == "week" - ? input.startTime.Split("-")[0] + "-" + (Int32.Parse(input.startTime.Split("-")[1]) + 1).ToString().PadLeft(2, '0') + "-01" - : input.tableType == "month" ? (Int32.Parse(input.startTime.Split("-")[0]) + 1) + "-01-01" - : input.tableType == "year" ? (Int32.Parse(input.endTime) + 1).ToString() + "-01-01" - : null; + var endTime = DateTime.Parse(startTime).AddMonths(1).ToString("yyyy-MM-dd"); string sqlWhere = ""; string sqlGroup = ""; string sqlAvgRawData = ""; @@ -239,11 +235,7 @@ namespace FrontendWebApi.ApiControllers ? input.startTime + "-01" : input.tableType == "month" || input.tableType == "year" ? input.startTime + "-01-01" : null; - var endTime = input.tableType == "day" || input.tableType == "week" - ? input.startTime.Split("-")[0] + "-" + (Int32.Parse(input.startTime.Split("-")[1]) + 1).ToString().PadLeft(2, '0') + "-01" - : input.tableType == "month" ? (Int32.Parse(input.startTime.Split("-")[0]) + 1) + "-01-01" - : input.tableType == "year" ? (Int32.Parse(input.endTime) + 1).ToString() + "-01-01" - : null; + var endTime = DateTime.Parse(startTime).AddMonths(1).ToString("yyyy-MM-dd"); string sqlWhere = ""; string sqlGroup = ""; string sqlAvgRawData = "";