How to use the d3-time-format.utcParse function in d3-time-format

To help you get started, we’ve selected a few d3-time-format 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 DefinitelyTyped / DefinitelyTyped / d3-time-format / d3-time-format-tests.ts View on Github external
let localeObj: d3TimeFormat.TimeLocaleObject;

// ----------------------------------------------------------------------
// Test Formating and Parsing
// ----------------------------------------------------------------------

// local time -----------------------------------------------------------

formatFn = d3TimeFormat.timeFormat('.%L');
parseFn = d3TimeFormat.timeParse('.%L');

// utc ------------------------------------------------------------------

formatFn = d3TimeFormat.utcFormat('.%L');
parseFn = d3TimeFormat.utcParse('.%L');

// iso ------------------------------------------------------------------

let dateString: string = d3TimeFormat.isoFormat(new Date(2016, 6, 6));
let date: Date = d3TimeFormat.isoParse('2016-07-08T14:06:41.386Z');

// ----------------------------------------------------------------------
// Test Locale Definition
// ----------------------------------------------------------------------

let dateTimeSpecifier: string = localeDef.dateTime;
let dateSpecifier: string = localeDef.date;
let timeSpecifier: string = localeDef.time;
let periods: [string, string] = localeDef.periods;
let days: [string, string, string, string, string, string, string] = localeDef.days;
let shortDays: [string, string, string, string, string, string, string] = localeDef.shortDays;
github DefinitelyTyped / DefinitelyTyped / types / d3-time-format / d3-time-format-tests.ts View on Github external
let localeObj: d3TimeFormat.TimeLocaleObject;

// ----------------------------------------------------------------------
// Test Formating and Parsing
// ----------------------------------------------------------------------

// local time -----------------------------------------------------------

formatFn = d3TimeFormat.timeFormat('.%L');
parseFn = d3TimeFormat.timeParse('.%L');

// utc ------------------------------------------------------------------

formatFn = d3TimeFormat.utcFormat('.%L');
parseFn = d3TimeFormat.utcParse('.%L');

// iso ------------------------------------------------------------------

let dateString: string = d3TimeFormat.isoFormat(new Date(2016, 6, 6));
let date: Date = d3TimeFormat.isoParse('2016-07-08T14:06:41.386Z');

// ----------------------------------------------------------------------
// Test Locale Definition
// ----------------------------------------------------------------------

let dateTimeSpecifier: string = localeDef.dateTime;
let dateSpecifier: string = localeDef.date;
let timeSpecifier: string = localeDef.time;
let periods: [string, string] = localeDef.periods;
let days: [string, string, string, string, string, string, string] = localeDef.days;
let shortDays: [string, string, string, string, string, string, string] = localeDef.shortDays;
github sghall / resonance / docs / src / routes / reduxExamples / stackedArea / module / index.js View on Github external
      const dates = data.map((d) => utcParse('%Y-%m-%dT%H:%M:%S.%LZ')(d.date));
github plouc / nivo / packages / scales / src / timeHelpers.js View on Github external
export const createDateNormalizer = ({
    format = 'native',
    precision = 'millisecond',
    useUTC = true,
}) => {
    const precisionFn = createPrecisionMethod(precision)
    if (format === 'native') return v => precisionFn(v)

    const parseTime = useUTC ? utcParse(format) : timeParse(format)
    return v => precisionFn(parseTime(v))
}
github sghall / resonance / docs / src / routes / reduxExamples / alluvialChart / module / index.js View on Github external
      const dates = data.map((d) => utcParse('%Y-%m-%dT%H:%M:%S.%LZ')(d.date));
github tgdn / cs261 / frontend / src / components / symbolchart.js View on Github external
const { BarSeries, LineSeries } = series
const { discontinuousTimeScaleProvider } = scale

const {
    CrossHairCursor,
    MouseCoordinateX,
    MouseCoordinateY,
    CurrentCoordinate,
    EdgeIndicator
} = coordinates

const { ClickCallback } = interactive
const { XAxis, YAxis } = axes
const { fitWidth } = helper

const parseDatetime = utcParse('%Y-%m-%dT%H:%M:%S.%LZ')

formatDefaultLocale({
    decimal: '.',
    thousands: ',',
    grouping: [3],
    currency: ['£', '']
})

class SymbolChart extends React.Component {
    constructor(props) {
        super(props)
        const { trades, minDatetime, maxDatetime, maxVolume } = this.parseData(this.props.trades)
        this.state = {
            trades,
            maxVolume,
            initialMinDatetime: minDatetime,
github domoritz / himawari-8-chrome / src / index.ts View on Github external
async function getLatestDscovrDate(imageType: ImageType) {
  const raw = await fetch(`${DSCOVR_BASE_URL}api/${imageType === DSCOVR_EPIC_ENHANCED ? "enhanced" : "natural"}`);
  const data: {date: string; image: string}[] = await raw.json();

  if (data.length === 0) { return null; }

  const latest = data[data.length - 1];
  return {
    date: utcParse("%Y-%m-%d %H:%M:%S")(latest.date),
    image: latest.image,
  }
}
github canonical-web-and-design / snapcraft.io / static / js / publisher / metrics / graphs / activeDevicesGraph / dataProcessing.js View on Github external
this.rawData.buckets.forEach((bucket, i) => {
    let obj = {
      date: utcParse("%Y-%m-%d")(bucket)
    };

    this.rawData.series.forEach(series => {
      obj[series.name] = series.values[i];
      if (_keys.indexOf(series.name) < 0) {
        _keys.push(series.name);
      }
    });

    _data.push(obj);
  });
github domoritz / himawari-8-chrome / src / index.ts View on Github external
async function getLatestSliderDate(imageType: ImageType) {
  const which = {
    GOES_16: 16,
    GOES_16_NATURAL: 16,
    GOES_17: 17,
  }[imageType];

  const raw = await fetch(`${SLIDER_BASE_URL}json/goes-${which}/full_disk/geocolor/latest_times.json`);
  const data: {timestamps_int: string[]} = await raw.json();

  return utcParse("%Y%m%d%H%M%S")(data.timestamps_int[0]);
}