JSFiddle - React, Tailwind, and code Playground

by hfougere

Babel + JSX

var date = new Date("2018-02-20");
tzOptions = {
  timeZone: 'America/New_York',
  timeZoneName: 'long'
};

var tzIntl = new Intl.DateTimeFormat('en-US', tzOptions);
var tzName = tzIntl.format(date).split(/,/g).map(a => a.trim())[1];
console.log(tzIntl.format(date))
console.log(tzName)


dateOptions = {
  year: 'numeric', month: 'long', day: 'numeric',
  hour: 'numeric', minute: 'numeric', second: 'numeric',
  hour12: false,
  weekday: 'short',  
  timeZone: 'America/New_York',
};

dateIntl =  new Intl.DateTimeFormat('en-US', dateOptions);
d = dateIntl.format(date).replace(/,/g, '').split(/[/ :]/)

console.log(`${d[0]}., ${d[1]} ${d[2]}, ${d[3]}`)

console.log(d)
//var d = dtf.format(date).replace(/,/g, '').split(/[/ :]/);

//console.log(d)


//Sun., August 5, 2018
//console.log();


///////
//console.log(dtf.resolvedOptions())