JSFiddle - React, Tailwind, and code Playground

by Cale Bergh

HTML

<input id="test" name="test" type="text">

JavaScript

$(document).ready(function() {
    // String operations (match) need the variable to be a string
    // Cast ms as a string 
    var ms = '' + +new Date;
    ms = ms.match(new RegExp('.{1,4}', 'g')).join("-").split('').reverse().join('');
    $('#test').val(ms);
});