[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.
This commit is contained in:
Géry Debongnie 2015-01-16 10:26:09 +01:00
parent a0e775e3fa
commit af8c2e4db6
1 changed files with 3 additions and 0 deletions

View File

@ -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]);
},