Registry / web-framework / vue-momentjs

vue-momentjs

JSON →
library1.0.0jsnpmunverified

This package, `vue-momentjs` v1.0.0, serves as a lightweight wrapper for the Moment.js library, designed specifically for applications built with Vue.js version 1.x. It simplifies integrating Moment.js functionalities into Vue components by exposing a `$moment()` instance. Released approximately six years ago and last updated around that time, the package is now considered abandoned. Its core dependency, Moment.js, has been in maintenance mode since September 2020 and is not recommended for new projects due to concerns regarding bundle size, object mutability, and modern JavaScript ecosystem compatibility. Furthermore, Vue 1.x has reached its end-of-life, making `vue-momentjs` incompatible with modern Vue 2.x or Vue 3.x applications. Users requiring date manipulation in current Vue projects should consider actively maintained alternatives like Day.js, Luxon, or `date-fns` with dedicated Vue 2/3 integrations.

npm install vue-momentjs
INSTALL
IMPORT
SIG · VUE-MOMENTJS
V
vue-momentjs
web-frameworkjavascriptv1.0.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

VueMomentJS
import VueMomentJS from 'vue-momentjs';
import { VueMomentJS } from 'vue-momentjs';
The primary way to import the plugin for ES Modules. It is likely a default export.
VueMomentJS
const VueMomentJS = require('vue-momentjs');
const { VueMomentJS } = require('vue-momentjs');
CommonJS import for Node.js environments. Given the package's age, this might have been the primary method initially.
$moment
this.$moment().format('LLL');
After installation via `Vue.use(VueMomentJS, moment)`, the Moment.js instance is available globally on Vue components as `this.$moment`.

Initializes `vue-momentjs` with Moment.js and demonstrates basic date formatting within a Vue 1.x component.

import Vue from 'vue'; import moment from 'moment'; import VueMomentJS from 'vue-momentjs'; // Install the plugin, passing the Moment.js library instance Vue.use(VueMomentJS, moment); // Create a basic Vue component const app = new Vue({ el: '#app', data: { message: 'Hello Vue with Moment.js!' }, mounted() { // Use this.$moment() to access Moment.js functionalities console.log('Current time:', this.$moment().format('MMMM Do YYYY, h:mm:ss a')); this.message = `Current time: ${this.$moment().format('MMMM Do YYYY, h:mm:ss a')}`; }, template: ` <div> <h1>{{ message }}</h1> <p>Formatted date from instance: {{ this.$moment('2023-01-15').format('dddd, MMMM Do YYYY') }}</p> </div> ` }); // Ensure you have a div with id='app' in your HTML: // <div id="app"></div>
Debug
Known issues
breakingThis package is designed for Vue 1.x and is incompatible with Vue 2.x or Vue 3.x due to significant API changes in newer Vue versions, including the removal of global Vue instance methods for plugin installation in Vue 3.
fix
Migrate to a modern date library (e.g., Day.js, Luxon, date-fns) and integrate it with a compatible Vue 2/3 wrapper or a custom composition API setup.
affects: >=1.0.0
deprecatedThe underlying `moment` library is in maintenance mode and not recommended for new projects. It will not receive new features and has known issues with bundle size and object mutability.
fix
Avoid using Moment.js in new projects. Consider modern alternatives like Day.js, Luxon, or date-fns, which are actively maintained and designed for modern JavaScript ecosystems.
affects: >=1.0.0
gotchaThe `vue-momentjs` package itself appears unmaintained, with its last publish date being approximately six years ago. This suggests a lack of support, bug fixes, or security updates.
fix
Discontinue use in production for any new development. Existing projects should assess the risk of using unmaintained software and consider migration.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: this.$moment is not a function
The `vue-momentjs` plugin was not correctly installed via `Vue.use(VueMomentJS, moment);` or Vue is not an active instance.
fix
Ensure `Vue.use(VueMomentJS, moment);` is called before instantiating Vue components and that `moment` is properly imported and passed as an argument.
Vue.use is not a function (when using Vue 3)
The global `Vue.use` method was removed in Vue 3. Plugin installation is now done on the application instance (e.g., `createApp().use(plugin)`). This package is only compatible with Vue 1.x.
fix
This package is not compatible with Vue 3. You must use a Vue 3 compatible date library and its corresponding plugin or integrate directly.
Uncaught ReferenceError: moment is not defined
The `moment` library was not imported or made globally available before `vue-momentjs` attempted to use it.
fix
Ensure you have `import moment from 'moment';` at the top of your file and that `moment` is listed as a dependency in your `package.json` and installed.
Upgrade
Version history
1.0.0latest on npm
Audit
Dependencies
momentrequiredRuntime dependency for date and time manipulation. Note: Moment.js is a deprecated library.
vuerequiredPeer dependency for the Vue.js framework. Note: This package targets Vue 1.x, which is End-of-Life.
Agent activity
7 hits · last 30 days
node
6
OpenAI (training)
1
Resources
vue-momentjs — npm install vue-momentjs · libregistry