PATH:
usr
/
local
/
lib
/
node_modules
/
knex-migrator
/
node_modules
/
moment
/
src
/
lib
/
moment
import { createLocal } from '../create/local'; import { cloneWithOffset } from '../units/offset'; import isFunction from '../utils/is-function'; import { hooks } from '../utils/hooks'; export function getCalendarFormat(myMoment, now) { var diff = myMoment.diff(now, 'days', true); return diff < -6 ? 'sameElse' : diff < -1 ? 'lastWeek' : diff < 0 ? 'lastDay' : diff < 1 ? 'sameDay' : diff < 2 ? 'nextDay' : diff < 7 ? 'nextWeek' : 'sameElse'; } 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'), format = hooks.calendarFormat(this, sod) || 'sameElse'; var output = formats && (isFunction(formats[format]) ? formats[format].call(this, now) : formats[format]); return this.format(output || this.localeData().calendar(format, this, createLocal(now))); }
[-] valid.js
[edit]
[+]
..
[-] start-end-of.js
[edit]
[-] now.js
[edit]
[-] to.js
[edit]
[-] min-max.js
[edit]
[-] constructor.js
[edit]
[-] to-type.js
[edit]
[-] diff.js
[edit]
[-] get-set.js
[edit]
[-] creation-data.js
[edit]
[-] compare.js
[edit]
[-] format.js
[edit]
[-] prototype.js
[edit]
[-] add-subtract.js
[edit]
[-] calendar.js
[edit]
[-] locale.js
[edit]
[-] moment.js
[edit]
[-] from.js
[edit]
[-] clone.js
[edit]