mirror of
https://github.com/NaN-tic/sao-base.git
synced 2023-12-14 03:13:01 +01:00
Fix revision management for momentjs
We need to be able to instantiate DateTime with epoch value. And we must use the momentjs operation to manupilate milliseconds. issue5451 review20911002
This commit is contained in:
parent
008db5d998
commit
8250cd946d
19
src/sao.js
19
src/sao.js
|
@ -122,17 +122,26 @@ var Sao = {};
|
|||
|
||||
Sao.DateTime = function(year, month, day, hour, minute, second,
|
||||
millisecond, utc) {
|
||||
var datetime = moment();
|
||||
var datetime;
|
||||
if (month === undefined) {
|
||||
datetime = moment(year);
|
||||
year = undefined;
|
||||
}
|
||||
else {
|
||||
datetime = moment();
|
||||
}
|
||||
if (utc) {
|
||||
datetime.utc();
|
||||
}
|
||||
datetime.year(year);
|
||||
datetime.month(month);
|
||||
datetime.date(day);
|
||||
datetime.hour(hour || 0);
|
||||
datetime.minute(minute || 0);
|
||||
datetime.second(second || 0);
|
||||
datetime.milliseconds(millisecond || 0);
|
||||
if (month !== undefined) {
|
||||
datetime.hour(hour || 0);
|
||||
datetime.minute(minute || 0);
|
||||
datetime.second(second || 0);
|
||||
datetime.milliseconds(millisecond || 0);
|
||||
}
|
||||
datetime.isDateTime = true;
|
||||
datetime.local();
|
||||
return datetime;
|
||||
|
|
|
@ -656,7 +656,7 @@
|
|||
return function(revision) {
|
||||
if (revision) {
|
||||
// Add a millisecond as microseconds are truncated
|
||||
revision.setMilliseconds(revision.getMilliseconds() + 1);
|
||||
revision.add(1, 'milliseconds');
|
||||
}
|
||||
if ((this.screen.current_view.view_type == 'form') &&
|
||||
(revision < revisions[revisions.length - 1][0])) {
|
||||
|
|
Loading…
Reference in a new issue