Core is small on purpose. Everything else is one import each, so an app only ships what it uses.
An extension adds to instances or to what yuga() reads. Install it with yuga.extend.
A plugin adds to yuga itself. Install it with yuga.plug.
import { relativeTime } from "yugajs/extension/relative-time" ;
import { duration } from "yugajs/plugin/duration" ;
yuga. extend (relativeTime);
yuga (). subtract ( 3 , "hours" ). fromNow (); // "3 hours ago"
Install them once, at the entry of your app. An extension is imported from yugajs/extension/<name> and a plugin from yugajs/plugin/<name>; each name below links to its exports in the API reference.
Extension
Adds
Day.js
advanced-format
X, x, k, z, zzz, wo, gggg, GGGG
advancedFormat
localized-format
LT, LTS, L, LL, LLL, LLLL and short forms
localizedFormat
relative-time
fromNow, from, toNow, to
relativeTime
calendar
calendar(): “Tomorrow at 2:05 PM”
calendar
buddhist-era
The BB and BBBB tokens
buddhistEra
to-array
toArray()
toArray
to-object
toObject()
toObject
Extension
Adds
Day.js
weeks
weekday, isoWeek, isoWeekday, weekYear, isoWeeksInYear, week tokens
weekday, isoWeek, weekYear, …
day-of-year
dayOfYear()
dayOfYear
is-leap-year
isLeapYear()
isLeapYear
is-between
isBetween(a, b, unit?, inclusivity?)
isBetween
is-today
isToday(), isTomorrow(), isYesterday()
Three plugins
plural-get-set
years(), months(), days(), …
pluralGetSet
locale-data
instance.localeData()
localeData
Plugin
Adds
Day.js
duration
yuga.duration, yuga.isDuration, durations in add
duration
min-max
yuga.min, yuga.max, yuga.median
minMax
locale-data
yuga.localeData, yuga.updateLocale
localeData, updateLocale