From 65ac1b3a70a8923379ff3abd41ae6ce0f9780a16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9ry=20Debongnie?= Date: Fri, 16 Jan 2015 10:26:09 +0100 Subject: [PATCH] [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. --- addons/web/static/src/js/pyeval.js | 3 +++ 1 file changed, 3 insertions(+) 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]); },