code: function formatDate(lang, input) {
  
  	var result = input;
  	var matches;
  	var localeDateString;
  
  	while ((matches = DATE_REGEX.exec(input)) != null) {
  
  		var date = new Date(Date.parse(matches[1]));
  		var format = matches[2] != undefined ? matches[2].toLowerCase() : "compact";
  
  		if (format != "compact") {
  			localeDateString = date.toLocaleDateString(lang,
  				{
  					day: "numeric",
  					weekday: format,
  					month: format,
  					year: "numeric"
  				});
  		}
  		else {
  			localeDateString = date.toLocaleDateString();
  		}
  		result = result.replace(matches[0], localeDateString);
  	};
  	return result;
  
  }
docs: This function is used to format the DATE.
  @example "Scheduled at {{DATE(2017-02-14T06:08:39Z,LONG)}}" formatted as "Tuesday, February 14, 2017"
  
  @param {string} lang
  @param {string} input
  @return {string} Text with `DATE` part formatted