mirror of https://github.com/apache/nifi.git
parent
76e31dfd19
commit
e4cee7ee0d
|
@ -1040,14 +1040,20 @@
|
||||||
if (date.length !== 3 || time.length !== 3) {
|
if (date.length !== 3 || time.length !== 3) {
|
||||||
return new Date();
|
return new Date();
|
||||||
}
|
}
|
||||||
|
var year = parseInt(date[2], 10);
|
||||||
|
var month = parseInt(date[0], 10) - 1; // new Date() accepts months 0 - 11
|
||||||
|
var day = parseInt(date[1], 10);
|
||||||
|
var hours = parseInt(time[0], 10);
|
||||||
|
var minutes = parseInt(time[1], 10);
|
||||||
|
|
||||||
// detect if there is millis
|
// detect if there is millis
|
||||||
var seconds = time[2].split(/\./);
|
var secondsSpec = time[2].split(/\./);
|
||||||
if (seconds.length === 2) {
|
var seconds = parseInt(secondsSpec[0], 10);
|
||||||
return new Date(parseInt(date[2], 10), parseInt(date[0], 10), parseInt(date[1], 10), parseInt(time[0], 10), parseInt(time[1], 10), parseInt(seconds[0], 10), parseInt(seconds[1], 10));
|
var milliseconds = 0;
|
||||||
} else {
|
if (secondsSpec.length === 2) {
|
||||||
return new Date(parseInt(date[2], 10), parseInt(date[0], 10), parseInt(date[1], 10), parseInt(time[0], 10), parseInt(time[1], 10), parseInt(time[2], 10), 0);
|
milliseconds = parseInt(secondsSpec[1], 10);
|
||||||
}
|
}
|
||||||
|
return new Date(year, month, day, hours, minutes, seconds, milliseconds);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue