Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function setupDateForPersianDate (date) {
if (isString(date)) {
let dd = date.substring(0, 19).replace('T', ' ')
if (rePersianDateTimeStr.exec(dd) !== null) {
let datetime = dd.replace(rePersianDateTimeStr, function (match, text) {
return match.split('-').join('/')
}).substring(0, 19).split(' ')
datetime[1] = (typeof datetime[1] !== 'undefined') ? datetime[1] : '00:00:00'
date = datetime[0].split('/').concat(datetime[1].split(':')).map(Number)
}
}
return date
}