How to use the @wordpress/date.date function in @wordpress/date

To help you get started, we’ve selected a few @wordpress/date 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 Automattic / jetpack / extensions / blocks / business-hours / components / day-preview.js View on Github external
formatTime( time ) {
		const { timeFormat } = this.props;
		const [ hours, minutes ] = time.split( ':' );
		const _date = new Date();
		if ( ! hours || ! minutes ) {
			return false;
		}
		_date.setHours( hours );
		_date.setMinutes( minutes );
		return date( timeFormat, _date );
	}
github Automattic / wp-calypso / packages / jetpack-blocks / src / blocks / business-hours / components / day-preview.jsx View on Github external
formatTime( time ) {
		const { timeFormat } = this.props;
		const [ hours, minutes ] = time.split( ':' );
		const _date = new Date();
		if ( ! hours || ! minutes ) {
			return false;
		}
		_date.setHours( hours );
		_date.setMinutes( minutes );
		return date( timeFormat, _date );
	}
github awethemes / awebooking / assets / babel / utils / date-utils.js View on Github external
export function formatDateString(dateString, format) {
  const { i18n } = window.awebooking || {};

  if (!dateString) {
    return '';
  }

  return date(format || i18n.dateFormat, dateString);
}