-1

I have Jquery input mask date that has format mm/dd/yyyy. When I type 17 for a year I want to convert it to 2017 and that works good but I have the issue when I type 21 it converts to 201 not 2021.

You can here see example: https://jsfiddle.net/u3em5bmr/1/

Edin Puzic
  • 998
  • 2
  • 19
  • 39

1 Answers1

-1

str = 'xx 22.07.03 yy';
str = str.replace(/(\d{2}.\d{2}).(\d{2})/g,'$1.20$2'); // $1='22.07' $2='03'
alert(str);