1.8.88 • Published 1 year ago

@taktikorg/dolor-laboriosam v1.8.88

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Nuxt Day.js module

Day.js Nuxt Module

Fast 2kB alternative to Moment.js with the same modern API

npm version npm downloads License Nuxt

Day.js Nuxt Module supporting v3

Features

  •  Nuxt 3 ready
  • 🚠  Activate any plugin or locale available
  • 🌲  Specify default locales and timezones

Quick Setup

  1. Add @taktikorg/dolor-laboriosam dependency to your project
npx nuxi@latest module add dayjs
  1. Add @taktikorg/dolor-laboriosam to the modules section of nuxt.config.ts
export default defineNuxtConfig({
  modules: [
    '@taktikorg/dolor-laboriosam'
  ]
})

Basic Usage

You can use the provided $dayjs to access Day.js in template.

<template>
  <div>
    <time :datetime="$dayjs('2023-01-01').utc().toString()"> {{ date }} </time>
  </div>
</template>

Composables

You can use the useDayjs composable to access Day.js anywhere.

<script setup>
  import { useDayjs } from '#dayjs' // not need if you are using auto import
  const dayjs = useDayjs()
  dayjs.locale('fr')
  dayjs.extend(...)
</script>

Configuration

You can specify any amount of locales, plugins, set a default locale, and set a default timezone

export default defineNuxtConfig({
  modules: ['@taktikorg/dolor-laboriosam'],
  dayjs: {
    locales: ['en', 'fr'],
    plugins: ['relativeTime', 'utc', 'timezone'],
    defaultLocale: 'en',
    defaultTimezone: 'America/New_York',
  }
})

By default we include the relativeTime and utc plugins, and always import updateLocale

External Plugins

export default defineNuxtConfig({
  modules: ['@taktikorg/dolor-laboriosam'],
  dayjs: {
    ...
    externalPlugins: [{
      name: 'dayjsBusinessDays',
      package: 'dayjs-business-days2',
      option: {
        holidays: [`2023-12-26`],
        holidayFormat: `YYYY-MM-DD`,
      }
    }]
    ...
  }
})

Optional defaultLocale customization

Instead of a locale string in defaultLocale:, you can define an array with a custom locale. See dayjs customization for more information.

Here is an example for a relativeTime configuration, lets create one that Gollum would understand:

export default defineNuxtConfig({
  modules: ['@taktikorg/dolor-laboriosam'],
  dayjs: {
    ...
    defaultLocale: ['en', {
      relativeTime: {
        future: "in %s",
        past: "%s ago",
        s: 'a few secondses',
        m: "a minute",
        mm: "%d minuteses",
        h: "an hour",
        hh: "%d hourses",
        d: "a day",
        dd: "%d dayses",
        M: "a month",
        MM: "%d monthseses",
        y: "a year",
        yy: "%d yearseses"
      }
    }]
    ...
  }
})

Development

# Install dependencies
npm install

# Generate type stubs
npm run dev:prepare

# Develop with the playground
npm run dev

# Build the playground
npm run dev:build

# Run ESLint
npm run lint

# Run Vitest
npm run test
npm run test:watch

# Release new version
npm run release
formshotincludesmixinsutilitiesharmonyURLSearchParamsbindbintypedarrayespreepackage managerrangeerrorarktypeindicatorsyntaxerrorSymbolfsprivate dataObject.keyspromiseelectronspawnArraypropgetterString.prototype.trimpushairbnbtypeofsigintprocesstc39transportArrayBufferRxmapreduceESdomECMAScript 2016assignendpointes6setPrototypeOfbusybrowserslistdescriptorhigher-orderreact animationclass-validatorcss variablefetchenvironmentsasterisksgitignorecsscallbinddragpackageshttpglobtypedarraysES2019checkECMAScript 2018ECMAScript 2019typanionObservablematchAllredirectInt16Arraycurriedlocationpropertiesform-validationagentreal-timesymbolseast-asian-widthjsdiffparsetranspilerhttpsplugincreateflatjsoncollection.es6cryptotostringtagcomparemergedom-testing-librarydescriptorsjwtRegExp.prototype.flags$.extendiamECMAScriptTypeBoxfunctionvaluecss-in-jstacitless.jslanguagenodejskoreanIteratornumbermake dirObject.fromEntriesObject.isdeep-copyenvcolorgetOwnPropertyDescriptoriterationstringifyMapargsconfigurableemitmruprogressses0prototypeHyBicorereact-testing-librarypyyamlutilsclasseswhatwgyamlpopmotionlinuxObject.valuesperformantnpmchaitddstatuscircularhasjswindowFloat32Arrayformatloggingreact-hookshandlersroute53saferapidsnsglobalThisperformanceES2018trimRightajvfast-copyidlemoveansiES2016handleriterateECMAScript 3fastcloneoncesetterchromechinesetypesafeArray.prototype.flatMapstylingstoragegatewayzodreact-hook-formnopeinternal slotReflect.getPrototypeOfrequestreact-componentdatastructuresubprocessloggerES8emrfigletweakmapcompilercallbackelmgroupByvariablesBigUint64ArraydataviewbddES2021telephonelesscssregexpframerjapanesePromiseprettyjsxdeep-clonesameValueZerolazyvisualuser-streamsArray.prototype.containsproxyECMAScript 2022invariantInt32Arrayebsmobileserializeecmascriptflagszerogeteslintconfigwhichreduxnpmignorecore-jsforEachiswgetmulti-packagereadhasOwnPropertypredictablemapfastcopyECMAScript 2021sharedtermTypeScriptnativeeventEmitterserializationkinesisprotoelbinputfullwidthmoduleszxtaketoSortedfluxquoteCSSStyleDeclarationinferencesuperagentpropertyxhroffsetfast-deep-copyforkvalidateObject.entriesMicrosoftchromiumtoolsconcatMapstateself
1.8.88

1 year ago

1.8.87

1 year ago

1.8.86

1 year ago

1.8.85

1 year ago

1.8.84

1 year ago

1.8.83

1 year ago

1.8.82

1 year ago

1.8.81

1 year ago

1.7.81

1 year ago

1.6.81

1 year ago

1.6.80

1 year ago

1.6.79

1 year ago

1.6.78

1 year ago

1.6.77

1 year ago

1.6.76

1 year ago

1.6.75

1 year ago

1.6.74

1 year ago

1.6.73

1 year ago

1.6.72

1 year ago

1.6.71

1 year ago

1.6.70

1 year ago

1.6.69

1 year ago

1.5.69

1 year ago

1.5.68

1 year ago

1.5.67

1 year ago

1.5.66

1 year ago

1.5.65

1 year ago

1.5.64

1 year ago

1.5.63

1 year ago

1.5.62

1 year ago

1.5.61

1 year ago

1.5.60

1 year ago

1.5.59

1 year ago

1.4.59

1 year ago

1.4.58

1 year ago

1.4.57

1 year ago

1.4.56

1 year ago

1.4.55

1 year ago

1.4.54

1 year ago

1.4.53

1 year ago

1.4.52

1 year ago

1.4.51

1 year ago

1.4.50

1 year ago

1.4.49

1 year ago

1.4.48

1 year ago

1.4.47

1 year ago

1.4.46

1 year ago

1.4.45

1 year ago

1.4.44

1 year ago

1.4.43

1 year ago

1.4.42

1 year ago

1.4.41

1 year ago

1.4.40

1 year ago

1.4.39

1 year ago

1.4.38

1 year ago

1.4.37

1 year ago

1.4.36

1 year ago

1.4.35

1 year ago

1.4.34

1 year ago

1.4.33

1 year ago

1.4.32

1 year ago

1.4.31

1 year ago

1.4.30

1 year ago

1.4.29

1 year ago

1.4.28

1 year ago

1.4.27

1 year ago

1.4.26

1 year ago

1.3.26

1 year ago

1.3.25

1 year ago

1.3.24

1 year ago

1.3.23

1 year ago

1.3.22

1 year ago

1.3.21

1 year ago

1.3.20

1 year ago

1.3.19

1 year ago

1.3.18

1 year ago

1.3.17

1 year ago

1.3.16

1 year ago

1.3.15

1 year ago

1.3.14

1 year ago

1.2.14

1 year ago

1.2.13

1 year ago

1.2.12

1 year ago

1.2.11

1 year ago

1.2.10

1 year ago

1.2.9

1 year ago

1.2.8

1 year ago

1.1.8

1 year ago

1.1.7

1 year ago

1.1.6

1 year ago

1.1.5

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago