forked from loafle/openapi-generator-original
This commit is contained in:
parent
c1b53df345
commit
9f1d012d14
@ -541,12 +541,15 @@
|
|||||||
{{/usePromises}} };
|
{{/usePromises}} };
|
||||||
|
|
||||||
{{#emitJSDoc}} /**
|
{{#emitJSDoc}} /**
|
||||||
* Parses an ISO-8601 string representation of a date value.
|
* Parses an ISO-8601 string representation or epoch representation of a date value.
|
||||||
* @param {String} str The date value as a string.
|
* @param {String} str The date value as a string.
|
||||||
* @returns {Date} The parsed date object.
|
* @returns {Date} The parsed date object.
|
||||||
*/
|
*/
|
||||||
{{/emitJSDoc}} exports.parseDate = function(str) {
|
{{/emitJSDoc}} exports.parseDate = function(str) {
|
||||||
return new Date(str.replace(/T/i, ' '));
|
if (isNaN(str)) {
|
||||||
|
return new Date(str.replace(/T/i, ' '));
|
||||||
|
}
|
||||||
|
return new Date(+str);
|
||||||
};
|
};
|
||||||
|
|
||||||
{{#emitJSDoc}} /**
|
{{#emitJSDoc}} /**
|
||||||
|
@ -519,12 +519,15 @@ class ApiClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
{{#emitJSDoc}}/**
|
{{#emitJSDoc}}/**
|
||||||
* Parses an ISO-8601 string representation of a date value.
|
* Parses an ISO-8601 string representation or epoch representation of a date value.
|
||||||
* @param {String} str The date value as a string.
|
* @param {String} str The date value as a string.
|
||||||
* @returns {Date} The parsed date object.
|
* @returns {Date} The parsed date object.
|
||||||
*/{{/emitJSDoc}}
|
*/{{/emitJSDoc}}
|
||||||
static parseDate(str) {
|
static parseDate(str) {
|
||||||
return new Date(str);
|
if (isNaN(str)) {
|
||||||
|
return new Date(str);
|
||||||
|
}
|
||||||
|
return new Date(+str);
|
||||||
}
|
}
|
||||||
|
|
||||||
{{#emitJSDoc}}/**
|
{{#emitJSDoc}}/**
|
||||||
|
@ -475,12 +475,15 @@ class ApiClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parses an ISO-8601 string representation of a date value.
|
* Parses an ISO-8601 string representation or epoch representation of a date value.
|
||||||
* @param {String} str The date value as a string.
|
* @param {String} str The date value as a string.
|
||||||
* @returns {Date} The parsed date object.
|
* @returns {Date} The parsed date object.
|
||||||
*/
|
*/
|
||||||
static parseDate(str) {
|
static parseDate(str) {
|
||||||
return new Date(str);
|
if (isNaN(str)) {
|
||||||
|
return new Date(str);
|
||||||
|
}
|
||||||
|
return new Date(+str);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -476,12 +476,15 @@ class ApiClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parses an ISO-8601 string representation of a date value.
|
* Parses an ISO-8601 string representation or epoch representation of a date value.
|
||||||
* @param {String} str The date value as a string.
|
* @param {String} str The date value as a string.
|
||||||
* @returns {Date} The parsed date object.
|
* @returns {Date} The parsed date object.
|
||||||
*/
|
*/
|
||||||
static parseDate(str) {
|
static parseDate(str) {
|
||||||
return new Date(str);
|
if (isNaN(str)) {
|
||||||
|
return new Date(str);
|
||||||
|
}
|
||||||
|
return new Date(+str);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user