Welcome to mirror list, hosted at ThFree Co, Russian Federation.

date_time_formatters.js « utils « monitoring « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: ad07a8465e2b3af51404563b231c83dc630ce547 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import d3 from 'd3';

export const dateFormat = d3.time.format('%b %-d, %Y');
export const dateFormatWithName = d3.time.format('%a, %b %-d');
export const timeFormat = d3.time.format('%-I:%M%p');
export const bisectDate = d3.bisector(d => d.time).left;

export const timeScaleFormat = d3.time.format.multi([
  ['.%L', d => d.getMilliseconds()],
  [':%S', d => d.getSeconds()],
  ['%-I:%M', d => d.getMinutes()],
  ['%-I %p', d => d.getHours()],
  ['%a %-d', d => d.getDay() && d.getDate() !== 1],
  ['%b %-d', d => d.getDate() !== 1],
  ['%B', d => d.getMonth()],
  ['%Y', () => true],
]);