Forum Discussion
viktor_n
5 years agoContributor II
Hi @NAl,
You can try this solution if there are no dates who are in 2000’s and are larger than the current year.
$Date comes in format “dd/mm/yy” and is type of string.
$Date.split('/')[2].length <= 2 ? Date.parse($Date).plusYears(Date.now().getFullYear() - $Date.split('/')[2] >= 2000 ? 2000 : 1900).toLocaleDateString({format:"YYYY-MM-dd"}) : Date.parse($Date).toLocaleDateString({format:"YYYY-MM-dd"})
If the year in $Date is larger then the current one that means is not 2000’s and will set as it is from 1900’s.
If it’s year with all 4 digits it will format as it is, otherwise if it’s 1 or 2 digits it will add the century.
Regards,
Viktor Nedanovski