JSFiddle - React, Tailwind, and code Playground JavaScript var date = 'yyyy/mm/dd'; date = date.replace(/\//g, '-'); alert(date);