{"id":20254193,"url":"https://github.com/fumeapp/dayjs","last_synced_at":"2025-04-11T23:21:00.975Z","repository":{"id":158655929,"uuid":"634156046","full_name":"fumeapp/dayjs","owner":"fumeapp","description":"Nuxt V3 module for Day.js","archived":false,"fork":false,"pushed_at":"2025-03-11T16:22:13.000Z","size":1085,"stargazers_count":117,"open_issues_count":15,"forks_count":12,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-04T06:32:01.611Z","etag":null,"topics":["dayjs","javascript","nuxt","nuxt-module"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fumeapp.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-04-29T08:14:17.000Z","updated_at":"2025-03-22T12:23:42.000Z","dependencies_parsed_at":null,"dependency_job_id":"70bdde72-9908-41c0-923d-ee496038b375","html_url":"https://github.com/fumeapp/dayjs","commit_stats":null,"previous_names":[],"tags_count":39,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fumeapp%2Fdayjs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fumeapp%2Fdayjs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fumeapp%2Fdayjs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fumeapp%2Fdayjs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fumeapp","download_url":"https://codeload.github.com/fumeapp/dayjs/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248493034,"owners_count":21113187,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dayjs","javascript","nuxt","nuxt-module"],"created_at":"2024-11-14T10:30:37.009Z","updated_at":"2025-04-11T23:21:00.951Z","avatar_url":"https://github.com/fumeapp.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"![Nuxt Day.js module](./.github/card.png)\n\n# Day.js Nuxt Module\n\n\u003e Fast 2kB alternative to Moment.js with the same modern API\n\n[![npm version][npm-version-src]][npm-version-href]\n[![npm downloads][npm-downloads-src]][npm-downloads-href]\n[![License][license-src]][license-href]\n[![Nuxt][nuxt-src]][nuxt-href]\n\n[Day.js](https://day.js.org/) Nuxt Module supporting v3\n\n- [✨ \u0026nbsp;Release Notes](/CHANGELOG.md)\n- [🏀 Online playground](https://stackblitz.com/github/fumeapp/dayjs?file=playground%2Fapp.vue)\n\u003c!-- - [📖 \u0026nbsp;Documentation](https://example.com) --\u003e\n\n## Features\n\n\u003c!-- Highlight some of the features your module provide here --\u003e\n\n- ⛰ \u0026nbsp;Nuxt 3 ready\n- 🚠 \u0026nbsp;Activate any plugin or locale available\n- 🌲 \u0026nbsp;Specify default locales and timezones\n\n## Quick Setup\n\n1. Add `dayjs-nuxt` dependency to your project\n\n```bash\nnpx nuxi@latest module add dayjs\n```\n\n2. Add `dayjs-nuxt` to the `modules` section of `nuxt.config.ts`\n\n```js\nexport default defineNuxtConfig({\n  modules: [\n    'dayjs-nuxt'\n  ]\n})\n```\n\n## Basic Usage\n\nYou can use the provided `$dayjs` to access Day.js in template.\n\n```vue\n\u003ctemplate\u003e\n  \u003cdiv\u003e\n    \u003ctime :datetime=\"$dayjs('2023-01-01').utc().toString()\"\u003e {{ date }} \u003c/time\u003e\n  \u003c/div\u003e\n\u003c/template\u003e\n```\n\n## Composables\n\nYou can use the `useDayjs()` and `dayjs()` composables to access Day.js anywhere.\n\n```vue\n\u003cscript setup\u003e\n  import { useDayjs, dayjs } from '#dayjs' // not need if you are using auto import\n\n  // access for dayjs globals\n  useDayjs().locale('fr')\n  useDayjs().extend(...)\n\n  // access for dayjs instance\n  console.log(dayjs().format('YYYY-MM-DD HH:mm:ss'))\n\u003c/script\u003e\n```\n\n## Configuration\n\nYou can specify any amount of locales, plugins, set a default locale, and set a default timezone\n\n```ts\nexport default defineNuxtConfig({\n  modules: ['dayjs-nuxt'],\n  dayjs: {\n    locales: ['en', 'fr'],\n    plugins: ['relativeTime', 'utc', 'timezone'],\n    defaultLocale: 'en',\n    defaultTimezone: 'America/New_York',\n  }\n})\n```\n\n\u003e By default we include the relativeTime and utc plugins, and always import updateLocale\n\n## External Plugins\n\n```ts\nexport default defineNuxtConfig({\n  modules: ['dayjs-nuxt'],\n  dayjs: {\n    ...\n    externalPlugins: [{\n      name: 'dayjsBusinessDays',\n      package: 'dayjs-business-days2',\n      option: {\n        holidays: [`2023-12-26`],\n        holidayFormat: `YYYY-MM-DD`,\n      }\n    }]\n    ...\n  }\n})\n```\n\n## Optional defaultLocale customization\n\nInstead of a locale string in `defaultLocale:`, you can define an array with a custom locale. See [dayjs customization](https://day.js.org/docs/en/customization/customization) for more information.\n\nHere is an example for a relativeTime configuration, lets create one that [Gollum](https://en.wiktionary.org/wiki/hobbitses) would understand:\n\n```ts\nexport default defineNuxtConfig({\n  modules: ['dayjs-nuxt'],\n  dayjs: {\n    ...\n    defaultLocale: ['en', {\n      relativeTime: {\n        future: \"in %s\",\n        past: \"%s ago\",\n        s: 'a few secondses',\n        m: \"a minute\",\n        mm: \"%d minuteses\",\n        h: \"an hour\",\n        hh: \"%d hourses\",\n        d: \"a day\",\n        dd: \"%d dayses\",\n        M: \"a month\",\n        MM: \"%d monthseses\",\n        y: \"a year\",\n        yy: \"%d yearseses\"\n      }\n    }]\n    ...\n  }\n})\n```\n\n## Development\n\n```bash\n# Install dependencies\nnpm install\n\n# Generate type stubs\nnpm run dev:prepare\n\n# Develop with the playground\nnpm run dev\n\n# Build the playground\nnpm run dev:build\n\n# Run ESLint\nnpm run lint\n\n# Run Vitest\nnpm run test\nnpm run test:watch\n\n# Release new version\nnpm run release\n```\n\n\u003c!-- Badges --\u003e\n\n[npm-version-src]: https://img.shields.io/npm/v/dayjs-nuxt/latest.svg?style=flat\u0026colorA=18181B\u0026colorB=28CF8D\n[npm-version-href]: https://npmjs.com/package/dayjs-nuxt\n[npm-downloads-src]: https://img.shields.io/npm/dm/dayjs-nuxt.svg?style=flat\u0026colorA=18181B\u0026colorB=28CF8D\n[npm-downloads-href]: https://npmjs.com/package/dayjs-nuxt\n[license-src]: https://img.shields.io/npm/l/dayjs-nuxt.svg?style=flat\u0026colorA=18181B\u0026colorB=28CF8D\n[license-href]: https://npmjs.com/package/dayjs-nuxt\n[nuxt-src]: https://img.shields.io/badge/Nuxt-18181B?logo=nuxt.js\n[nuxt-href]: https://nuxt.com\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffumeapp%2Fdayjs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffumeapp%2Fdayjs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffumeapp%2Fdayjs/lists"}