diff --git a/documentation/changelog.rst b/documentation/changelog.rst index 88977402f..1f9795cbf 100644 --- a/documentation/changelog.rst +++ b/documentation/changelog.rst @@ -26,6 +26,7 @@ v0.4.1 | May XX, 2021 Bugfixes ----------- * Fix regression when editing assets in the UI [see `PR #122 `_] +* Fixed a regression that stopped asset, market and sensor selection from working [see `PR #117 `_] * Prevent logging out user when clearing the session [see `PR #112 `_] * Prevent user type data source to be created without setting a user [see `PR #111 `_] diff --git a/flexmeasures/ui/static/js/daterange-utils.js b/flexmeasures/ui/static/js/daterange-utils.js new file mode 100644 index 000000000..41c5f3f48 --- /dev/null +++ b/flexmeasures/ui/static/js/daterange-utils.js @@ -0,0 +1,19 @@ +// Date range utils +export function subtract(oldDate, nDays) { + var newDate = new Date(oldDate) + newDate.setDate(newDate.getDate() - nDays); + return newDate; +} +export function thisMonth(oldDate) { + var d1 = new Date(oldDate) + d1.setDate(1); + var d2 = new Date(d1.getFullYear(), d1.getMonth() + 1, 0); + return [d1, d2]; +}; +export function lastNMonths(oldDate, nMonths) { + var d0 = new Date(oldDate) + var d1 = new Date(d0.getFullYear(), d0.getMonth() - nMonths + 2, 0); + d1.setDate(1); + var d2 = new Date(d0.getFullYear(), d0.getMonth() + 1, 0); + return [d1, d2]; +}; diff --git a/flexmeasures/ui/static/js/flexmeasures.js b/flexmeasures/ui/static/js/flexmeasures.js index 66e00404c..8dd0becba 100644 --- a/flexmeasures/ui/static/js/flexmeasures.js +++ b/flexmeasures/ui/static/js/flexmeasures.js @@ -310,24 +310,3 @@ function submit_market() { function submit_sensor_type() { $("#sensor_type-form").attr("action", empty_location).submit(); } - - -// Date range utils -export function subtract(oldDate, nDays) { - var newDate = new Date(oldDate) - newDate.setDate(newDate.getDate() - nDays); - return newDate; -} -export function thisMonth(oldDate) { - var d1 = new Date(oldDate) - d1.setDate(1); - var d2 = new Date(d1.getFullYear(), d1.getMonth() + 1, 0); - return [d1, d2]; -}; -export function lastNMonths(oldDate, nMonths) { - var d0 = new Date(oldDate) - var d1 = new Date(d0.getFullYear(), d0.getMonth() - nMonths + 2, 0); - d1.setDate(1); - var d2 = new Date(d0.getFullYear(), d0.getMonth() + 1, 0); - return [d1, d2]; -}; diff --git a/flexmeasures/ui/templates/base.html b/flexmeasures/ui/templates/base.html index b0fcc770f..9dfd7b3a0 100644 --- a/flexmeasures/ui/templates/base.html +++ b/flexmeasures/ui/templates/base.html @@ -209,7 +209,7 @@ - + {% if show_datepicker %} {% endif %} diff --git a/flexmeasures/ui/templates/views/sensors.html b/flexmeasures/ui/templates/views/sensors.html index 2800d5f8c..5bb5c7e15 100644 --- a/flexmeasures/ui/templates/views/sensors.html +++ b/flexmeasures/ui/templates/views/sensors.html @@ -25,7 +25,7 @@