diff options
| author | Géry Debongnie <ged@odoo.com> | 2015-01-16 10:26:09 +0100 |
|---|---|---|
| committer | Géry Debongnie <ged@odoo.com> | 2015-01-19 14:08:09 +0100 |
| commit | af8c2e4db6b44019e2c649088e9eca8263ff3e40 (patch) | |
| tree | 90a713a5ad0c854992cf504df8cb641f37707d40 /addons/web/static/src/js/pyeval.js | |
| parent | a0e775e3fa8b0316af33cff2501f6006aba54890 (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/js/pyeval.js')
| -rw-r--r-- | addons/web/static/src/js/pyeval.js | 3 |
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]); }, |
