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

Function timeMultiFormat

docs/app/js/sanddance-app.js:110040–110045  ·  view source on GitHub ↗
(format, interval, spec)

Source from the content-addressed store, hash-verified

110038 return arguments.length ? defaultNumberLocale = numberFormatLocale(definition) : defaultNumberLocale;
110039}
110040function timeMultiFormat(format, interval, spec) {
110041 spec = spec || {};
110042 if (!(0, _vegaUtil.isObject)(spec)) (0, _vegaUtil.error)("Invalid time multi-format specifier: ".concat(spec));
110043 const second = interval((0, _vegaTime.SECONDS)), minute = interval((0, _vegaTime.MINUTES)), hour = interval((0, _vegaTime.HOURS)), day = interval((0, _vegaTime.DATE)), week = interval((0, _vegaTime.WEEK)), month = interval((0, _vegaTime.MONTH)), quarter = interval((0, _vegaTime.QUARTER)), year = interval((0, _vegaTime.YEAR)), L = format(spec[0, _vegaTime.MILLISECONDS] || ".%L"), S = format(spec[0, _vegaTime.SECONDS] || ":%S"), M = format(spec[0, _vegaTime.MINUTES] || "%I:%M"), H = format(spec[0, _vegaTime.HOURS] || "%I %p"), d = format(spec[0, _vegaTime.DATE] || spec[0, _vegaTime.DAY] || "%a %d"), w = format(spec[0, _vegaTime.WEEK] || "%b %d"), m = format(spec[0, _vegaTime.MONTH] || "%B"), q = format(spec[0, _vegaTime.QUARTER] || "%B"), y = format(spec[0, _vegaTime.YEAR] || "%Y");
110044 return (date)=>(second(date) < date ? L : minute(date) < date ? S : hour(date) < date ? M : day(date) < date ? H : month(date) < date ? week(date) < date ? d : w : year(date) < date ? quarter(date) < date ? m : q : y)(date);
110045}
110046function timeLocale(locale2) {
110047 const timeFormat = memoize(locale2.format), utcFormat = memoize(locale2.utcFormat);
110048 return {

Callers 1

timeLocaleFunction · 0.70

Calls 4

intervalFunction · 0.70
formatFunction · 0.70
weekFunction · 0.70
quarterFunction · 0.70

Tested by

no test coverage detected