Commit 931e982d authored by Mat's avatar Mat
Browse files

calcule le range total du slider

parent c59c0e4f
...@@ -131,9 +131,6 @@ ...@@ -131,9 +131,6 @@
{% include '@Potage/LettreInfos/ajaxDisplay.js' %} {% include '@Potage/LettreInfos/ajaxDisplay.js' %}
console.log('hop:');
console.log(new Date(2018, 5, 1));
</script> </script>
{% endblock %} {% endblock %}
...@@ -215,15 +215,19 @@ function displayDateRangeSlider(minDate, maxDate) ...@@ -215,15 +215,19 @@ function displayDateRangeSlider(minDate, maxDate)
let dows = ['di', 'lu', 'ma', 'me', 'je', 've', 'sa']; let dows = ['di', 'lu', 'ma', 'me', 'je', 've', 'sa'];
let firstDay = 1; //lundi let firstDay = 1; //lundi
console.log(new Date(minDate).getDate()); let beforeMinDate = 20; // l'écart minimal entre le minBounds et le minDate
let lengthBounds = 3; // le range en mois
let minD = new Date(minDate); let minD = new Date(minDate);
let maxD = new Date(maxDate); let maxD = new Date(maxDate);
let minBounds = new Date(minD.getTime());
minBounds.setDate(minD.getDate() - beforeMinDate);
$("#dateRuleSlider").dateRangeSlider({ $("#dateRuleSlider").dateRangeSlider({
bounds: { bounds: {
min: new Date(2018, 5, 1), min: new Date(minBounds.getFullYear(), minBounds.getMonth(), 1),
max: new Date(2018, 8, 1) max: new Date(2018, (minBounds.getMonth() + lengthBounds), 1)
}, },
defaultValues: { defaultValues: {
min: new Date(minD.getFullYear(), minD.getMonth(), minD.getDate()), min: new Date(minD.getFullYear(), minD.getMonth(), minD.getDate()),
...@@ -240,7 +244,8 @@ function displayDateRangeSlider(minDate, maxDate) ...@@ -240,7 +244,8 @@ function displayDateRangeSlider(minDate, maxDate)
year = valeur.getFullYear(); year = valeur.getFullYear();
return dow + " " + formatNumber(days, 2) + "/" + formatNumber(month, 2); return dow + " " + formatNumber(days, 2) + "/" + formatNumber(month, 2);
}, },
scales: [{ scales: [
{
first: function(value){ return value; }, first: function(value){ return value; },
end: function(value) {return value; }, end: function(value) {return value; },
next: function(value){ next: function(value){
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment