How to use the date-fns/format 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 Gaya / ab-testing-for-wp / src / js / components / Admin / pages / Overview / Overview.tsx View on Github external
<div>
            <span>
              {postLink(__('Edit'), test.postLink, test.id)}
              {isSingle &amp;&amp; ' | '}
            </span>
            {isSingle &amp;&amp; (
              <span>
                {removeLink(test.postDeleteLink)}
              </span>
            )}
          </div>
        
        {test.startedAt &gt; 0 ? (
          
            <abbr title="{`${format(test.startedAt,">
              {format(test.startedAt, 'yyyy/MM/dd')}
            </abbr>
            {` (${formatDistance(new Date(), test.startedAt)})`}
          
        ) : (
          —
        )}
        
          {
            isSingle
              ? <code>{`[ab-test id=${test.postId}]`}</code>
              : postLink(test.postName, test.postLink, test.id)
          }
        
        {postLink(test.goalName, test.goalLink)}
        {test.totalParticipants}
github grubersjoe / react-github-calendar / src / lib / services / contributions.js View on Github external
  const begin = contributions.findIndex(contrib => contrib.date === format(now, DATE_FORMAT));
github vuetifyjs / vuetify / packages / vuetifyjs.com / src / examples / date-pickers / dateFormattingMomentDatefns.vue View on Github external
computedDateFormattedDatefns () {
        return this.date ? format(this.date, 'dddd, MMMM Do YYYY') : ''
      }
    }
github clauderic / react-infinite-calendar / src / Header / defaultSelectionRenderer.js View on Github external
scrollToDate(date, -40, true);
        }
      },
      item: 'day',
      title: display === 'days'
        ? `Scroll to ${format(date, dateFormat, {locale})}`
        : null,
      value: format(date, dateFormat, {locale}),
    },
  ];

  return (
    <div aria-label="{format(date,">
      {values.map(({handleClick, item, key, value, active, title}) =&gt; {
        return (
          <div title="{title}">
            </div></div>
github luontola / cqrs-hotel / src / main / js / routes.js View on Github external
async function getRooms() {
  const start = format(new Date(), 'YYYY-MM-DD');
  const end = format(addDays(new Date(), 7), 'YYYY-MM-DD');
  const response = await api.get(`/api/availability/${start}/${end}`);
  return response.data;
}
github ThymeApp / thyme / src / sections / Reports / components / DateRange / index.js View on Github external
<button size="small">
          Week to date
        </button>
        <button size="small">
          This month
        </button>
        <button size="small">
          Last month
        </button>
      

      <div>
        <input size="mini" name="from" value="{format(from," type="date">
        <span style="{{">
          to
        </span>
        <input size="mini" name="to" value="{format(to," type="date">
      </div>
    
  );
github vusion / cloud-ui / src / u-calendar-month.vue / index.js View on Github external
            const _trans = (d) => format(d, 'YYYYMM');
            const month = _trans(date);
github loomnetwork / vue-block-explorer / src / components / block-list.ts View on Github external
async showBlock(blockHeight: number) {
    const block = await this.blockchain.fetchBlock(blockHeight)
    const item = {
      blockHeight: block.height,
      numTransactions: block.numTxs,
      hash: block.hash,
      age: distanceInWordsToNow(new Date(block.time)),
      time: formatDate(new Date(block.time), 'YYYY-MM-DD HH:mm:ss.SSS (Z)'),
      block
    }
    this.selectItem(item)
  }