Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function formatDateAtIndex(
dates: ?Date | ?Array,
index: number,
) {
if (!dates || !Array.isArray(dates)) return '';
const date = dates[index];
if (!date) return '';
return formatDate(date, 'yyyy/MM/dd');
}
function formatDateAtIndex(
dates: Date | Array,
index: number,
) {
if (!dates || !Array.isArray(dates)) return '';
const date = dates[index];
if (!date) return '';
return formatDate(date, 'yyyy/MM/dd') as string;
}