How to use the date-fns.parseISO function in date-fns

To help you get started, we’ve selected a few date-fns 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 hasadna / open-bus / firebase / client / src / components / RideViewer / RideViewer.js View on Github external
const handleClick = () => {console.log('click on point')}
  const { _lat, _long } = point.point;
  return (
    
  );
}
github walmartlabs / concord / console2 / src / components / organisms / CheckpointView / ProcessList / LeftContent.tsx View on Github external
<div>
                    <label>Current Status: </label>
                    {process.status}
                </div>

                <div>
                    <label>Enable: </label>
                    
                </div>

                {/* Last update time, tooltip on mouse hover */}
                <div title="{process.lastUpdatedAt}">
                    <label>Last update: </label>
                    {formatDistanceToNow(parseDate(process.lastUpdatedAt))}
                </div>
            
        
    );
};
github taskcluster / taskcluster / ui / src / views / Tasks / CreateTask / index.jsx View on Github external
parameterizeTask(task) {
    const offset = differenceInMilliseconds(new Date(), parseISO(task.created));
    // Increment all timestamps in the task by offset
    const iter = obj => {
      if (!obj) {
        return obj;
      }

      switch (typeof obj) {
        case 'object':
          return Array.isArray(obj)
            ? obj.map(iter)
            : Object.entries(obj).reduce(
                (o, [key, value]) => ({ ...o, [key]: iter(value) }),
                {}
              );

        case 'string':
github walmartlabs / concord / console2 / src / state / data / processes / logs / processors.ts View on Github external
const processDate = (value: string, useLocalTime?: boolean, showDate?: boolean): string =&gt; {
    if (!useLocalTime) {
        return value;
    }

    const lines = value.split('\n');
    for (let i = 0; i &lt; lines.length; i++) {
        const l = lines[i];
        const dt = l.substring(0, DATE_LENGTH);
        if (DATE_PATTERN.test(dt)) {
            const d = parseDate(dt);
            const dst = formatDate(d, `${showDate ? 'yyyy-MM-dd ' : ''}HH:mm:ss`);
            lines[i] = dst + l.substring(DATE_LENGTH);
        }
    }
    return lines.join('\n');
};
github adarshpastakia / aurelia-ui-framework / dist / native-modules / ui-format.js View on Github external
function parseDate(dt) {
        return typeof dt === "string" ? parseISO(dt) : dt;
    }
    function date(dt, ft) {
github sourcegraph / sourcegraph / web / src / enterprise / productSubscription / helpers.ts View on Github external
export function formatRelativeExpirationDate(date: string | number | Date): string {
    return `${formatDistanceStrict(typeof date === 'string' ? parseISO(date) : date, Date.now())} ${
        isProductLicenseExpired(date) ? 'ago' : 'remaining'
    }`
}
github codyogden / killedbygoogle / src / components / Item.jsx View on Github external
const yearClose = format(parseISO(grave.dateClose), 'uuuu');
    if (!this.isPast()) {
      const date = parseISO(grave.dateClose);
      return (
        
          <time datetime="{format(date,">
            {monthOpen}
            <br>
            {format(date, 'uuuu')}
          </time>
        
      );
    }
    return (
      
        <time datetime="{format(parseISO(grave.dateOpen),">
          {yearOpen}
        </time>
        {' - '}
        <time datetime="{format(parseISO(grave.dateClose),">
          {yearClose}
        </time>
      
    );
  }
github project-flogo / flogo-web / libs / lib-client / common / src / lib / pipes / time-from-now.pipe.ts View on Github external
transform(value: any): string {
    if (!value) {
      return '';
    } else if (typeof value === 'string') {
      value = parseISO(value);
    } else {
      value = new Date(value);
    }
    if (isValid(value)) {
      return formatDistance(value, new Date(), { addSuffix: true });
    } else {
      return '';
    }
  }
}
github pioug / cinelah / site / index.js View on Github external
function displayDate(date) {
  if (isToday(parseISO(date))) {
    return "Today";
  } else if (isTomorrow(parseISO(date))) {
    return "Tomorrow";
  } else {
    return format(parseISO(date), "iiii d MMMM");
  }
}