summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/framework
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2017-01-23 14:33:53 +0100
committerChristophe Simonis <chs@odoo.com>2017-01-23 14:33:53 +0100
commit6c4389df41fb29f9707b205a8dcca13b3bf8a322 (patch)
treeb06358fdcff3268574c9ccda8cb36d9f94eb09dd /addons/web/static/src/js/framework
parent255de893300d73670a15a102e85162ae48084d7c (diff)
parent6804085b8ceb1411a23db65477f84a959f8c5bf7 (diff)
[MERGE] forward port branch 10.0 up to 6804085b8ce
Diffstat (limited to 'addons/web/static/src/js/framework')
-rw-r--r--addons/web/static/src/js/framework/formats.js12
1 files changed, 8 insertions, 4 deletions
diff --git a/addons/web/static/src/js/framework/formats.js b/addons/web/static/src/js/framework/formats.js
index d084b285f6c..479fa1082cd 100644
--- a/addons/web/static/src/js/framework/formats.js
+++ b/addons/web/static/src/js/framework/formats.js
@@ -161,26 +161,30 @@ function parse_value (value, descriptor, value_if_empty) {
return parse_value(value, {type: "float"});
case 'datetime':
var datetime = moment(value, [date_pattern + ' ' + time_pattern, date_pattern_wo_zero + ' ' + time_pattern_wo_zero, moment.ISO_8601], true);
- if (datetime.isValid())
+ if (datetime.isValid() && datetime.year() >= 1900)
return time.datetime_to_str(datetime.toDate());
datetime = moment(value, [date_pattern + ' ' + time_pattern, date_pattern_wo_zero + ' ' + time_pattern_wo_zero, moment.ISO_8601]);
if (datetime.isValid()) {
if (datetime.year() === 0) {
datetime.year(moment.utc().year());
}
- return time.datetime_to_str(datetime.toDate());
+ if (datetime.year() >= 1900) {
+ return time.datetime_to_str(datetime.toDate());
+ }
}
throw new Error(_.str.sprintf(_t("'%s' is not a correct datetime"), value));
case 'date':
var date = moment(value, [date_pattern, date_pattern_wo_zero, moment.ISO_8601], true);
- if (date.isValid())
+ if (date.isValid() && date.year() >= 1900)
return time.date_to_str(date.toDate());
date = moment(value, [date_pattern, date_pattern_wo_zero, moment.ISO_8601]);
if (date.isValid()) {
if (date.year() === 0) {
date.year(moment.utc().year());
}
- return time.date_to_str(date.toDate());
+ if (date.year() >= 1900) {
+ return time.date_to_str(date.toDate());
+ }
}
throw new Error(_.str.sprintf(_t("'%s' is not a correct date"), value));
case 'time':