How to use the d3-time.timeMonth function in d3-time

To help you get started, we’ve selected a few d3-time examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github GlobalFishingWatch / map-client / app / src / timebar / components / Timebar.jsx View on Github external
const customTickFormat = (date, index, allDates) => {
  let format;
  if (d3timeDay(date) < date) {
    format = '%I %p';
  } else if (d3timeMonth(date) < date) {
    format = d3timeWeek(date) < date ? '%a %d' : '%b %d';
  } else if (d3timeYear(date) < date) {
    if (index === 0) {
      format = '%b %Y';
    } else {
      format = (allDates.length >= 15 || window.innerWidth < 1024) ? '%b' : '%B';
    }
  } else {
    format = '%Y';
  }
  return d3timeFormat(format)(date);
};
github feedzai / brushable-histogram / src / utils.js View on Github external
export function multiDateFormat(date) {
    let formatter;

    if (timeSecond(date) < date) {
        formatter = formatMillisecond;
    } else if (timeMinute(date) < date) {
        formatter = formatSecond;
    } else if (timeHour(date) < date) {
        formatter = formatMinute;
    } else if (timeDay(date) < date) {
        formatter = formatHour;
    } else if (timeMonth(date) < date) {
        if (timeWeek(date) < date) {
            formatter = formatDay;
        } else {
            formatter = formatWeek;
        }
    } else if (timeYear(date) < date) {
        formatter = formatMonth;
    } else {
        formatter = formatYear;
    }

    return formatter(date);
}
github facette / facette / ui / src / components / chart / chart.vue View on Github external
format: (date: Date): string => {
                                const format: (specifier: string) => (date: Date) => string = timezoneUTC.value
                                    ? utcFormat
                                    : timeFormat;

                                return (timeSecond(date) < date
                                    ? format(".%L")
                                    : timeMinute(date) < date
                                    ? format(":%S")
                                    : timeHour(date) < date
                                    ? format("%H:%M")
                                    : timeDay(date) < date
                                    ? format("%H:00")
                                    : timeMonth(date) < date
                                    ? format("%a %d")
                                    : timeYear(date) < date
                                    ? format("%B")
                                    : timeFormat("%Y"))(date);
                            },
                        },
github appnexus / lucid / src / components / Axis / examples / 6.time.jsx View on Github external
render() {
		return (
			<svg height="{height}" width="{width}">
				<g transform="{`translate(${margin.left},">
					
				</g>

				<g transform="{`translate(${margin.left},">
					
				</g>

				<g transform="{`translate(${margin.left},">
					
				</g>
			</svg>
		);
	}
});