1.8.88 • Published 10 months ago

@taktikorg/dolor-laboriosam v1.8.88

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months 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

10 months ago

1.8.87

10 months ago

1.8.86

10 months ago

1.8.85

10 months ago

1.8.84

10 months ago

1.8.83

10 months ago

1.8.82

10 months ago

1.8.81

11 months ago

1.7.81

11 months ago

1.6.81

11 months ago

1.6.80

11 months ago

1.6.79

11 months ago

1.6.78

11 months ago

1.6.77

11 months ago

1.6.76

11 months ago

1.6.75

11 months ago

1.6.74

11 months ago

1.6.73

11 months ago

1.6.72

11 months ago

1.6.71

11 months ago

1.6.70

11 months ago

1.6.69

11 months ago

1.5.69

11 months ago

1.5.68

11 months ago

1.5.67

11 months ago

1.5.66

11 months ago

1.5.65

11 months ago

1.5.64

11 months ago

1.5.63

11 months ago

1.5.62

11 months ago

1.5.61

11 months ago

1.5.60

11 months ago

1.5.59

11 months ago

1.4.59

11 months ago

1.4.58

11 months ago

1.4.57

11 months ago

1.4.56

11 months ago

1.4.55

12 months ago

1.4.54

12 months ago

1.4.53

12 months ago

1.4.52

12 months ago

1.4.51

12 months ago

1.4.50

12 months ago

1.4.49

12 months ago

1.4.48

12 months ago

1.4.47

12 months ago

1.4.46

12 months ago

1.4.45

12 months ago

1.4.44

12 months ago

1.4.43

12 months ago

1.4.42

12 months ago

1.4.41

12 months ago

1.4.40

12 months ago

1.4.39

12 months ago

1.4.38

12 months ago

1.4.37

12 months ago

1.4.36

12 months 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