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 MacKentoch / react-redux-graphql-apollo-bootstrap-webpack-starter / src / front / redux / modules / userAuth.js View on Github external
export function setUserLogout(time: string = format(new Date(), dateFormat)) {
  auth.clearAllAppStorage();
  return {
    type: SET_USER_LOGOUT,
    time,
    isAuthenticated: false,
    user: emptyUser,
  };
}
// //////////////////////////////
github Wikiki / bulma-calendar / src / js / datePicker / index.js View on Github external
})));


		if (this.min && dateFns.differenceInMonths(this._visibleDate, this.min) === 0) {
			this._togglePreviousButton(false);
		} else {
			this._togglePreviousButton();
		}

		if (this.max && dateFns.differenceInMonths(this._visibleDate, this.max) === 0) {
			this._toggleNextButton(false);
		} else {
			this._toggleNextButton();
		}

		this._ui.navigation.month.innerHTML = dateFns.format(this._visibleDate, 'MMMM', {
			locale: this.locale
		});
		this._ui.navigation.year.innerHTML = dateFns.format(this._visibleDate, 'YYYY', {
			locale: this.locale
		});

		this._renderDays();

		this._ui.body.dates.classList.add('is-active');
		this._ui.body.months.classList.remove('is-active');
		this._ui.body.years.classList.remove('is-active');
		this._ui.navigation.previous.removeAttribute('disabled');
		this._ui.navigation.next.removeAttribute('disabled');

		return this;
	}
github geeofree / kalendaryo / src / index.js View on Github external
getFormattedDate = (arg = this.state.date, dateFormat) => {
    if (isDate(arg) && dateFormat === undefined) {
      return format(arg, this.props.defaultFormat)
    }

    if (typeof arg === 'string' && dateFormat === undefined) {
      return format(this.state.date, arg)
    }

    if (isDate(arg) && typeof dateFormat === 'string') {
      return format(arg, dateFormat)
    }

    misusageThrow('getFormattedDate')
  }
github veritone / veritone-sdk / packages / veritone-react-common / src / components / TranscriptEngineOutput / SpeakerTranscriptContent / index.js View on Github external
const speakerSeries = speakerSegment.series.map((speakerSerie, speakerIndex) => {
          const startZeroTime = new Date(1990, 8, 15);
          const stopZeroTime = new Date(1990, 8, 15);
          startZeroTime.setMilliseconds(speakerSerie.startTimeMs);
          stopZeroTime.setMilliseconds(speakerSerie.stopTimeMs);
          const speakerStartTime = startZeroTime.getTime();
          const speakerStopTime = stopZeroTime.getTime();
          const timeFormat = speakerSerie.startTimeMs >= 3600000 ? 'HH:mm:ss' : 'mm:ss';
          const speakerTimingStart = format(speakerStartTime, timeFormat);
          const speakerTimingStop = format(speakerStopTime, timeFormat);
          const speakerGridKey = `speaker-edit-row-${speakerSerie.guid}`;

          const speakerContent = (
github Councilbox / cbx-quorum-explorer / webapp / src / components / Blocks / BlockRow.js View on Github external
type='block'>
                                {props.data.hash}
                            
                        
                        
                            No. of transactions
                        
                        
                            {transactionCount()}
                        
                    
                
            :
                
                    
                        {format(new Date(props.data.timestamp * 1000), DATE_FORMAT)}
                    
                    
                        
                            {props.data.number.toLocaleString()}
                        
                    
                    
                        
                            {props.data.hash}
github remotelock / react-week-scheduler / index.js View on Github external
var formatHour = function formatHour(date) {
  if (dateFns.getMinutes(date) === 0) {
    return dateFns.format(date, 'h');
  }

  return dateFns.format(date, 'h:m');
};
github nginformatica / flipper-ui / src / charts / LineVerticalBarChart.tsx View on Github external
const toCartesianPlan = ([x, y]: TData) => ({
    x: format(toDate(x), 'MMM/yy', { locale: ptBR }),
    y
})
github yupaits / docs-manage / docs-client / docs-ui / src / views / ReadDoc.vue View on Github external
dateFormat(date) {
        return dateFns.format(date, 'YYYY-MM-DD HH:mm:ss');
      }
    },
github adarshpastakia / aurelia-ui-framework / src / calendar / ui-date.ts View on Github external
set minute(m) {
    this.time = setMinutes(this.time, parseInt(m, 10));
    this.dateChanged(
      toDate(
        format(this.date || new Date(), "yyyy-MM-dd") + "T" + format(this.time, "HH:mm:ss.000")
      )
    );
    this.fireChange(true);
  }
  @computedFrom("time")