JSFiddle - React, Tailwind, and code Playground

by Jake

JavaScript

var getDateParts = function(datestr){
  var x = '2017-01-22';
  var dateRegExp = new RegExp('([0-9]{2,4})-([0-9]{1,2})-([0-9]{1,2})');
  var matches = dateRegExp.exec(x);
	/*var out = {
	    year: matches[1],
	    month: matches[2],
	    day: matches[3]
	  }
	  console.log(out); */
    console.log(matches);
};