This commit is contained in:
2019-03-04 21:47:47 +00:00
parent 4135950055
commit ea24d476f6
3 changed files with 10 additions and 8 deletions

View File

@@ -28,10 +28,15 @@ export default {
//Put back the time portion from before
var combinedDateAndTimeAsString = that.value.substr(0, 11) + time;
//===========================================
//PARSE THE TIME AND DATE
//NOTE: FOLLOWING CODE ADAPTED FROM A LIBRARY:
//https://github.com/csnover/js-iso8601
//Only change is to make it a local function and move "numericKeys" variable into the code block
var timestamp,
struct,
minutesOffset = 0,
numericKeys = [ 1, 4, 5, 6, 7, 10, 11 ];
numericKeys = [1, 4, 5, 6, 7, 10, 11];
// ES5 §15.9.4.2 states that the string should attempt to be parsed as a Date Time String Format string
// before falling back to any implementation-specific date parsing, so thats what we do, even if native
@@ -71,12 +76,9 @@ export default {
} else {
timestamp = Date.parse(combinedDateAndTimeAsString);
}
//==========================================
var newDateAsString = new Date(timestamp).toISOString();
// var dateObjectFromString = new Date(combinedDateAndTimeAsString);
// var newDateAsString = dateObjectFromString.toISOString();
that.$emit("input", newDateAsString);
}
}