MCPcopy Index your code
hub / github.com/microsoft/SandDance / formatDate

Function formatDate

docs/app/js/sanddance-app.js:109244–109247  ·  view source on GitHub ↗
(date)

Source from the content-addressed store, hash-verified

109242 return year < 0 ? "-" + pad(-year, 6) : year > 9999 ? "+" + pad(year, 6) : pad(year, 4);
109243}
109244function formatDate(date) {
109245 var hours = date.getUTCHours(), minutes = date.getUTCMinutes(), seconds = date.getUTCSeconds(), milliseconds = date.getUTCMilliseconds();
109246 return isNaN(date) ? "Invalid Date" : formatYear(date.getUTCFullYear(), 4) + "-" + pad(date.getUTCMonth() + 1, 2) + "-" + pad(date.getUTCDate(), 2) + (milliseconds ? "T" + pad(hours, 2) + ":" + pad(minutes, 2) + ":" + pad(seconds, 2) + "." + pad(milliseconds, 3) + "Z" : seconds ? "T" + pad(hours, 2) + ":" + pad(minutes, 2) + ":" + pad(seconds, 2) + "Z" : minutes || hours ? "T" + pad(hours, 2) + ":" + pad(minutes, 2) + "Z" : "");
109247}
109248exports.default = function(delimiter) {
109249 var reFormat = new RegExp('["' + delimiter + "\n\r]"), DELIMITER = delimiter.charCodeAt(0);
109250 function parse(text, f) {

Callers 1

formatValueFunction · 0.70

Calls 2

formatYearFunction · 0.70
padFunction · 0.70

Tested by

no test coverage detected