summaryrefslogtreecommitdiff
path: root/addons/web/static/src
diff options
context:
space:
mode:
authorniv-openerp <nicolas.vanhoren@openerp.com>2012-11-29 17:07:46 +0100
committerniv-openerp <nicolas.vanhoren@openerp.com>2012-11-29 17:07:46 +0100
commitf9b9e7c4cb040d6dce43e8ba3616a1453a1d0db9 (patch)
tree94429a4f98372423376788b7ab2a57a6f76ed2dd /addons/web/static/src
parented532ba3f2b57274a33a5e49119362b231688657 (diff)
[IMP] added context_today()
bzr revid: nicolas.vanhoren@openerp.com-20121129160746-c3c691zk5fxhzse0
Diffstat (limited to 'addons/web/static/src')
-rw-r--r--addons/web/static/src/js/pyeval.js17
1 files changed, 12 insertions, 5 deletions
diff --git a/addons/web/static/src/js/pyeval.js b/addons/web/static/src/js/pyeval.js
index 68a7453c958..4ee9fea0584 100644
--- a/addons/web/static/src/js/pyeval.js
+++ b/addons/web/static/src/js/pyeval.js
@@ -402,11 +402,6 @@ openerp.web.pyeval = function (instance) {
d.getUTCHours(), d.getUTCMinutes(), d.getUTCSeconds(),
d.getUTCMilliseconds() * 1000]);
}),
- today: py.classmethod.fromJSON(function () {
- var d = new Date();
- return py.PY_call(datetime.datetime,
- [d.getUTCFullYear(), d.getUTCMonth() + 1, d.getUTCDate()]);
- }),
combine: py.classmethod.fromJSON(function () {
var args = py.PY_parseArgs(arguments, 'date time');
return py.PY_call(datetime.datetime, [
@@ -479,6 +474,17 @@ openerp.web.pyeval = function (instance) {
return py.PY_call(datetime.date, [year, month, day])
}
});
+ /**
+ Returns the current local date, which means the date on the client (which can be different
+ compared to the date of the server).
+
+ @return {datetime.date}
+ */
+ var context_today = function() {
+ var d = new Date();
+ return py.PY_call(
+ datetime.date, [d.getFullYear(), d.getMonth() + 1, d.getDate()]);
+ };
datetime.time = py.type('time', null, {
__init__: function () {
var zero = py.float.fromJSON(0);
@@ -691,6 +697,7 @@ openerp.web.pyeval = function (instance) {
return {
uid: py.float.fromJSON(instance.session.uid),
datetime: datetime,
+ context_today: context_today,
time: time,
relativedelta: relativedelta,
current_date: py.PY_call(