Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function formatAsDate(loggingEvent, specifier) {
let format = dateFormat.ISO8601_FORMAT;
if (specifier) {
format = specifier;
// Pick up special cases
if (format === 'ISO8601') {
format = dateFormat.ISO8601_FORMAT;
} else if (format === 'ISO8601_WITH_TZ_OFFSET') {
format = dateFormat.ISO8601_WITH_TZ_OFFSET_FORMAT;
} else if (format === 'ABSOLUTE') {
format = dateFormat.ABSOLUTETIME_FORMAT;
} else if (format === 'DATE') {
format = dateFormat.DATETIME_FORMAT;
}
}
// Format the date
return dateFormat.asString(format, loggingEvent.startTime);
}
function formatAsDate(loggingEvent, specifier) {
let format = dateFormat.ISO8601_FORMAT;
if (specifier) {
format = specifier;
// Pick up special cases
if (format === 'ISO8601') {
format = dateFormat.ISO8601_FORMAT;
} else if (format === 'ISO8601_WITH_TZ_OFFSET') {
format = dateFormat.ISO8601_WITH_TZ_OFFSET_FORMAT;
} else if (format === 'ABSOLUTE') {
format = dateFormat.ABSOLUTETIME_FORMAT;
} else if (format === 'DATE') {
format = dateFormat.DATETIME_FORMAT;
}
}
// Format the date
return dateFormat.asString(format, loggingEvent.startTime);
}
function formatAsDate(loggingEvent, specifier) {
let format = dateFormat.ISO8601_FORMAT;
if (specifier) {
format = specifier;
// Pick up special cases
if (format === 'ISO8601') {
format = dateFormat.ISO8601_FORMAT;
} else if (format === 'ISO8601_WITH_TZ_OFFSET') {
format = dateFormat.ISO8601_WITH_TZ_OFFSET_FORMAT;
} else if (format === 'ABSOLUTE') {
format = dateFormat.ABSOLUTETIME_FORMAT;
} else if (format === 'DATE') {
format = dateFormat.DATETIME_FORMAT;
}
}
// Format the date
return dateFormat.asString(format, loggingEvent.startTime);
}
function formatAsDate(loggingEvent, specifier) {
let format = dateFormat.ISO8601_FORMAT;
if (specifier) {
format = specifier;
// Pick up special cases
if (format === 'ISO8601') {
format = dateFormat.ISO8601_FORMAT;
} else if (format === 'ISO8601_WITH_TZ_OFFSET') {
format = dateFormat.ISO8601_WITH_TZ_OFFSET_FORMAT;
} else if (format === 'ABSOLUTE') {
format = dateFormat.ABSOLUTETIME_FORMAT;
} else if (format === 'DATE') {
format = dateFormat.DATETIME_FORMAT;
}
}
// Format the date
return dateFormat.asString(format, loggingEvent.startTime);
}