Is there a way in Moment.js to obtain a short year format (two digits only) for a localized date ?
moment().format('l'); // 1/23/2017
moment().format('<someSpecialFormat>'); // expected: 1/23/17
Any help or link to a related topic would be much appreciated.
Thanks,
var formatL = moment.localeData().longDateFormat('L');
var formatYearlessL = formatL.replace(/YYYY/g,'YY');
console.log(moment().format(formatYearlessL));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With