MCPcopy Index your code
hub / github.com/plotly/plotly.js / modDateFormat

Function modDateFormat

src/lib/dates.js:386–409  ·  view source on GitHub ↗
(fmt, x, formatter, calendar)

Source from the content-addressed store, hash-verified

384 4: '2',
385};
386function modDateFormat(fmt, x, formatter, calendar) {
387 fmt = fmt.replace(fracMatch, function(match) {
388 var digits = Math.min(+(match.charAt(1)) || 6, 6);
389 var fracSecs = ((x / 1000 % 1) + 2)
390 .toFixed(digits)
391 .slice(2).replace(/0+$/, '') || '0';
392 return fracSecs;
393 });
394
395 var d = new Date(Math.floor(x + 0.05));
396
397 fmt = fmt.replace(halfYearMatch, function() {
398 return quarterToHalfYear[formatter('%q')(d)];
399 });
400
401 if(isWorldCalendar(calendar)) {
402 try {
403 fmt = Registry.getComponentMethod('calendars', 'worldCalFmt')(fmt, x, calendar);
404 } catch(e) {
405 return 'Invalid';
406 }
407 }
408 return formatter(fmt)(d);
409}
410
411/*
412 * formatTime: create a time string from:

Callers 1

dates.jsFile · 0.85

Calls 2

isWorldCalendarFunction · 0.85
formatterFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…