summaryrefslogtreecommitdiff
path: root/addons/web/static/src
diff options
context:
space:
mode:
authorGéry Debongnie <ged@odoo.com>2015-01-16 10:26:09 +0100
committerGéry Debongnie <ged@odoo.com>2015-01-19 14:08:09 +0100
commitaf8c2e4db6b44019e2c649088e9eca8263ff3e40 (patch)
tree90a713a5ad0c854992cf504df8cb641f37707d40 /addons/web/static/src
parenta0e775e3fa8b0316af33cff2501f6006aba54890 (diff)
[IMP] pyeval: implement weekday function
courtesy of mva. This adds the weekday function to date objects in pyeval. This will be useful for adding better filters (such as this week) in the searchview.
Diffstat (limited to 'addons/web/static/src')
-rw-r--r--addons/web/static/src/js/pyeval.js3
1 files changed, 3 insertions, 0 deletions
diff --git a/addons/web/static/src/js/pyeval.js b/addons/web/static/src/js/pyeval.js
index 57e2eaa1499..4cb17e70f29 100644
--- a/addons/web/static/src/js/pyeval.js
+++ b/addons/web/static/src/js/pyeval.js
@@ -517,6 +517,9 @@
toordinal: function () {
return py.float.fromJSON(ymd2ord(this.year, this.month, this.day));
},
+ weekday: function () {
+ return py.float.fromJSON((this.toordinal().toJSON()+6)%7);
+ },
fromJSON: function (year, month, day) {
return py.PY_call(datetime.date, [year, month, day]);
},