From 3db7f8647c72d0209df7aad4c413f85c36e12fcf Mon Sep 17 00:00:00 2001 From: "wanling040@gmail.com" Date: Fri, 8 Jul 2022 09:37:45 +0800 Subject: [PATCH] =?UTF-8?q?debug:=20=E9=9B=BB=E7=AB=99=E8=B3=87=E8=A8=8A-?= =?UTF-8?q?=E5=96=AE=E9=A0=81(=E5=8D=B3=E6=99=82=E8=B3=87=E8=A8=8A)?= =?UTF-8?q?=E5=8D=A1=E4=BD=8F=E4=B8=8D=E9=A1=AF=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Views/StationOverview/StationOverviewInfo.cshtml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/SolarPower/Views/StationOverview/StationOverviewInfo.cshtml b/SolarPower/Views/StationOverview/StationOverviewInfo.cshtml index 7b7649b..dd93dbb 100644 --- a/SolarPower/Views/StationOverview/StationOverviewInfo.cshtml +++ b/SolarPower/Views/StationOverview/StationOverviewInfo.cshtml @@ -193,7 +193,7 @@ opens: 'left' }, function (start, end, label) { }); - + $('#date-range-history').on('apply.daterangepicker', function (ev, picker) { $(this).val(picker.startDate.format('YYYY-MM-DD') + ' ~ ' + picker.endDate.format('YYYY-MM-DD')); $(this).trigger('change'); @@ -211,8 +211,10 @@ var today_format = today.toISOString().slice(0, 10).replace(/-/g, "/"); //var dateLimit_format = dateLimit.toISOString().slice(0, 10).replace(/-/g, "/"); //datepicker.data('daterangepicker').setStartDate(dateLimit_format); - datepicker.data('daterangepicker').setStartDate(today_format); - datepicker.data('daterangepicker').setEndDate(today_format); + if (datepicker.length != 0) { + datepicker.data('daterangepicker').setStartDate(today_format); + datepicker.data('daterangepicker').setEndDate(today_format); + } //$('#date-range-history').val(dateLimit_format + ' - ' + today_format); $('#date-range-history').val(today_format + ' ~ ' + today_format); //alert(" date-range-history = "+$('#date-range-history').val()); @@ -839,7 +841,7 @@ locale: { format: 'YYYY/MM/DD' }, opens: 'left' }, function (start, end, label) { - @* console.log("A new date selection was made: " + start.format('YYYY-MM-DD') + ' to ' + end.format('YYYY-MM-DD'));*@ + @* console.log("A new date selection was made: " + start.format('YYYY-MM-DD') + ' to ' + end.format('YYYY-MM-DD'));*@ }); $('#date-range-exception').on('apply.daterangepicker', function (ev, picker) { @@ -1652,7 +1654,6 @@ datepicker.data('daterangepicker').setStartDate(dateLimit_format); datepicker.data('daterangepicker').setEndDate(today_format); - $('#date-range-record').val(dateLimit_format + ' - ' + today_format); $('#date-range-record').trigger('change'); }