PHP Classes

File: vendors/gentelella/vendors/moment/src/lib/moment/calendar.js

Recommend this page to a friend!
  Classes of Jorge Castro   Gentelella BladeOne   vendors/gentelella/vendors/moment/src/lib/moment/calendar.js   Download  
File: vendors/gentelella/vendors/moment/src/lib/moment/calendar.js
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: Gentelella BladeOne
Render templates using Bootstrap for presentation
Author: By
Last change:
Date: 3 years ago
Size: 890 bytes
 

Contents

Class file image Download
import { createLocal } from '../create/local'; import { cloneWithOffset } from '../units/offset'; import isFunction from '../utils/is-function'; export function calendar (time, formats) { // We want to compare the start of today, vs this. // Getting start-of-today depends on whether we're local/utc/offset or not. var now = time || createLocal(), sod = cloneWithOffset(now, this).startOf('day'), diff = this.diff(sod, 'days', true), format = diff < -6 ? 'sameElse' : diff < -1 ? 'lastWeek' : diff < 0 ? 'lastDay' : diff < 1 ? 'sameDay' : diff < 2 ? 'nextDay' : diff < 7 ? 'nextWeek' : 'sameElse'; var output = formats && (isFunction(formats[format]) ? formats[format]() : formats[format]); return this.format(output || this.localeData().calendar(format, this, createLocal(now))); }