[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 1daad04823
commit 65ac1b3a70
+3
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]);
},