web/facet.py
branchstable
changeset 2149 6a631ec5cc71
parent 2130 caa5acbecc08
child 2152 edec2c9055e5
--- a/web/facet.py	Tue Jun 23 15:37:51 2009 +0200
+++ b/web/facet.py	Tue Jun 23 15:39:30 2009 +0200
@@ -10,7 +10,7 @@
 
 from itertools import chain
 from copy import deepcopy
-from datetime import date
+from datetime import date, datetime
 
 from logilab.mtconverter import html_escape
 
@@ -683,8 +683,15 @@
 
 
 class DateFacetRangeWidget(FacetRangeWidget):
+
     formatter = 'function (value) {return (new Date(parseFloat(value))).strftime(DATE_FMT);}'
+
+    def round_max_value(self, d):
+        'round to upper value to avoid filtering out the max value'
+        return datetime(d.year, d.month, d.day + 1)
+
     def __init__(self, facet, minvalue, maxvalue):
+        maxvalue = self.round_max_value(maxvalue)
         super(DateFacetRangeWidget, self).__init__(facet,
                                                    datetime2ticks(minvalue),
                                                    datetime2ticks(maxvalue))