JSFiddle - React, Tailwind, and code Playground

by supercool

JavaScript

(function() {
    var months = ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];
  function fetch(n) {
    return n<10? '0'+n : ''+n;
  }
    function output(dat){
    var d = new Date(dat.replace(/(\d+)([-\/\\\.])(\d+)/, "$3$2$1"));
        return fetch(d.getDate())+'-'+months[d.getMonth()]+'-'+(d.getFullYear()+'').slice(-2);}
    window.output=output; //exposes the output function outside
}());



alert(output('13-12-2014'));