{"_id":"@bordman1/vue-moment","_rev":"1-7a9e08f2c592dabe9ec57404de6cfaa5","name":"@bordman1/vue-moment","description":"Handy Moment.js filters for your Vue.js project","dist-tags":{"latest":"3.1.0"},"versions":{"3.1.0":{"name":"@bordman1/vue-moment","version":"3.1.0","description":"Handy Moment.js filters for your Vue.js project","main":"vue-moment.js","_from":"@bordman1/vue-moment@3.1.0","scripts":{"test":"jest"},"repository":{"type":"git","url":"git+https://github.com/bordman/vue-moment/vue-moment.git"},"keywords":["vue","custom","date","time","filter","moment","moment.js"],"author":{"name":"brockpetrie"},"license":"MIT","bugs":{"url":"https://github.com/brockpetrie/vue-moment/issues"},"homepage":"https://github.com/brockpetrie/vue-moment#readme","dependencies":{"moment":"^2.11.1"},"peerDependencies":{"vue":">=1.x.x"},"devDependencies":{"babel-core":"^6.26.0","babel-jest":"^21.2.0","babel-loader":"^7.1.2","babel-preset-env":"^1.6.1","jest":"^21.2.1","jest-serializer-vue":"^0.2.0","jest-vue":"^0.8.1","moment-timezone":"^0.5.14","vue":"^2.5.2"},"jest":{"moduleFileExtensions":["js","vue"],"moduleNameMapper":{"^@/(.*)$":"<rootDir>/$1"},"transform":{"^.+\\.js$":"<rootDir>/node_modules/babel-jest",".*\\.(vue)$":"<rootDir>/node_modules/jest-vue"},"snapshotSerializers":["<rootDir>/node_modules/jest-serializer-vue"],"mapCoverage":true},"directories":{"test":"tests"},"gitHead":"7c53f2466f642c53a28e4a9960bc0ffc4a908a19","_id":"@bordman1/vue-moment@3.1.0","_npmVersion":"5.5.1","_nodeVersion":"8.9.1","_npmUser":{"name":"bordman1","email":"b0rdm4n@gmail.com"},"dist":{"integrity":"sha512-k98MIJ6wbtuSlOkeWvn2CnFDsxNM1whlYeJ23kEAZh0UhmDxgwiU+Y0QQ/yFXaY9KR/YNIC+g4vQO4XiZV7Ngg==","shasum":"c2342185982feebd2f3e963ec0b32b10cfd8afd7","tarball":"https://registry.npmjs.org/@bordman1/vue-moment/-/vue-moment-3.1.0.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDjST31/tPYX7dYvG63LnLm4uI+Q3wqcnEGRR2dVQpkEwIgZ9nDB9NbRs6fSmrlUJf00Ppm4IsJMsWpeCoSCbmRyvE="}]},"maintainers":[{"name":"bordman1","email":"b0rdm4n@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/vue-moment-3.1.0.tgz_1515054475140_0.8144227038137615"}}},"readme":"# vue-moment\r\n[![npm version](https://badge.fury.io/js/vue-moment.svg)](https://badge.fury.io/js/vue-moment) [![Build Status](https://travis-ci.org/brockpetrie/vue-moment.svg?branch=master)](https://travis-ci.org/brockpetrie/vue-moment)\r\n\r\nHandy [Moment.js](http://www.momentjs.com) filters for your [Vue.js](http://vuejs.org/) project.\r\n\r\n## Installation\r\n\r\nInstall via NPM...\r\n\r\n```sh\r\n$ npm install vue-moment\r\n```\r\n\r\n...and require the plugin like so:\r\n\r\n```js\r\nVue.use(require('vue-moment'));\r\n```\r\n\r\n## Usage\r\n\r\nSimply set `moment` as the filtering function and you're good to go. At least one argument is expected, which the filter assumes to be a `format` string if the argument doesn't match any of the other filtering methods.\r\n\r\n```html\r\n<span>{{ someDate | moment(\"dddd, MMMM Do YYYY\") }}</span>\r\n<!-- or create a new date from 'now' -->\r\n<span>{{ new Date() | moment(\"dddd, MMMM Do YYYY\") }}</span>\r\n```\r\n\r\n## Passing Your Date\r\n\r\nMoment.js expects your input to be either: a valid ISO 8601 formatted string (see <http://momentjs.com/docs/#/parsing/string/>), a valid `Date` object, a Unix timestamp (must be passed as a Number), or a date string with an accompanying format pattern (i.e. when you know the format of the date input). For the latter, `vue-moment` allows you to pass your date and format pattern(s) as an array, like such:\r\n\r\n```html\r\n<span>{{ [ someDate, \"MM.DD.YY\" ] | moment(\"dddd, MMMM Do YYYY\") }}</span>\r\n<!-- or when you want to parse against more than one pattern -->\r\n<span>{{ [ someDate, [\"MM.DD.YY\", \"MM-DD-YY\", \"MM-DD-YYYY\"] ] | moment(\"dddd, MMMM Do YYYY\") }}</span>\r\n```\r\n\r\nAs of 3.0.0, passing an empty or invalid input will no longer initiate moment with a new `Date` object.\r\n\r\n## Filtering Methods\r\n\r\n### format (default)\r\n\r\nThis is the default filtering option. Formats the date against a string of tokens. See <http://momentjs.com/docs/#/displaying/format/> for a list of tokens and examples.\r\n\r\n**Default**\r\n\r\n```html\r\n<span>{{ someDate | moment(\"YYYY\") }}</span>\r\n<!-- e.g. \"2010\" -->\r\n<span>{{ someDate | moment(\"ddd, hA\") }}</span>\r\n<!-- e.g. \"Sun, 3PM\" -->\r\n<span>{{ someDate | moment(\"dddd, MMMM Do YYYY, h:mm:ss a\") }}</span>\r\n<!-- e.g. \"Sunday, February 14th 2010, 3:25:50 pm\" -->\r\n```\r\n\r\nFor more information about `moment#format`, check out <http://momentjs.com/docs/#/displaying/format/>.\r\n\r\n\r\n### from\r\n\r\nDisplay a moment in relative time, either from now or from a specified date.\r\n\r\n**Default** (calculates from current time)\r\n\r\n```html\r\n<span>{{ someDate | moment(\"from\", \"now\") }}</span>\r\n<!-- or shorthanded -->\r\n<span>{{ someDate | moment(\"from\") }}</span>\r\n```\r\n\r\n**With a reference time given**\r\n\r\n```html\r\n<span>{{ someDate | moment(\"from\", \"Jan. 11th, 1985\") }}</span>\r\n```\r\n\r\n**With suffix hidden** (e.g. '4 days ago' -> '4 days')\r\n\r\n```html\r\n<span>{{ someDate | moment(\"from\", \"now\", true) }}</span>\r\n<!-- or -->\r\n<span>{{ someDate | moment(\"from\", true) }}</span>\r\n<!-- or with a reference time -->\r\n<span>{{ someDate | moment(\"from\", \"Jan. 11th, 2000\", true) }}</span>\r\n```\r\n\r\nFor more information about `moment#fromNow` and `moment#from`, check out <http://momentjs.com/docs/#/displaying/fromnow/> and <http://momentjs.com/docs/#/displaying/from/>.\r\n\r\n\r\n### calendar\r\n\r\nFormats a date with different strings depending on how close to a certain date (today by default) the date is.\r\n\r\n**Default** (calculates from current time)\r\n\r\n```html\r\n<span>{{ someDate | moment(\"calendar\") }}</span>\r\n<!-- e.g. \"Last Monday 2:30 AM\" -->\r\n```\r\n\r\n**With a reference time given**\r\n\r\n```html\r\n<span>{{ someDate | moment(\"calendar\", \"July 10 2011\") }}</span>\r\n<!-- e.g. \"7/10/2011\" -->\r\n```\r\n\r\nFor more information about `moment#calendar`, check out <http://momentjs.com/docs/#/displaying/calendar-time/>.\r\n\r\n\r\n### add\r\n\r\nMutates the original moment by adding time.\r\n\r\n```html\r\n<span>{{ someDate | moment(\"add\", \"7 days\") }}</span>\r\n<!-- or with multiple keys -->\r\n<span>{{ someDate | moment(\"add\", \"1 year, 3 months, 30 weeks, 10 days\") }}</span>\r\n```\r\n\r\nFor more information about `moment#add`, check out <http://momentjs.com/docs/#/manipulating/add/>.\r\n\r\n\r\n### subtract\r\n\r\nWorks the same as `add`, but mutates the original moment by subtracting time.\r\n\r\n```html\r\n<span>{{ someDate | moment(\"subtract\", \"3 hours\") }}</span>\r\n```\r\n\r\nFor more information about `moment#subtract`, check out <http://momentjs.com/docs/#/manipulating/subtract/>.\r\n\r\n### timezone\r\n\r\nConvert the date to a certain timezone\r\n\r\n```html\r\n<span>{{ date | moment('timezone', 'America/Los_Angeles', 'LLLL ss')}}</span>\r\n```\r\n\r\n**To use this filter you will need to pass `moment-timezone` through to the plugin**\r\n\r\n```js\r\n// main.js\r\nimport Vue from 'vue'\r\nimport VueMoment from 'vue-moment'\r\nimport moment from 'moment-timezone'\r\n\r\nVue.use(VueMoment, {\r\n    moment,\r\n})\r\n```\r\n\r\nFor more information about `moment#timezone`, check out <https://momentjs.com/timezone/docs/#/using-timezones/converting-to-zone/>.\r\n\r\n\r\n## Chaining\r\n\r\nThere's some built-in (and not thoroughly tested) support for chaining, like so:\r\n\r\n```html\r\n<span>{{ someDate | moment(\"add\", \"2 years, 8 days\", \"subtract\", \"3 hours\", \"ddd, hA\") }}</span>\r\n```\r\n\r\nThis would add 2 years and 8 months to the date, then subtract 3 hours, then format the resulting date.\r\n\r\n\r\n## Configuration\r\n\r\n`vue-moment` should respect any global Moment customizations, including i18n locales. For more info, check out <http://momentjs.com/docs/#/customization/>.\r\n\r\nYou can also pass a custom Moment object through with the plugin options. This technique is especially useful for overcoming the browserify locale bug demonstrated in the docs <http://momentjs.com/docs/#/use-it/browserify/>\r\n\r\n```js\r\nconst moment = require('moment')\r\nrequire('moment/locale/es')\r\n\r\nVue.use(require('vue-moment'), {\r\n    moment\r\n})\r\n\r\nconsole.log(Vue.moment().locale()) //es\r\n```\r\n","maintainers":[{"name":"bordman1","email":"b0rdm4n@gmail.com"}],"time":{"modified":"2022-04-04T20:12:36.699Z","created":"2018-01-04T08:27:56.222Z","3.1.0":"2018-01-04T08:27:56.222Z"},"homepage":"https://github.com/brockpetrie/vue-moment#readme","keywords":["vue","custom","date","time","filter","moment","moment.js"],"repository":{"type":"git","url":"git+https://github.com/bordman/vue-moment/vue-moment.git"},"author":{"name":"brockpetrie"},"bugs":{"url":"https://github.com/brockpetrie/vue-moment/issues"},"license":"MIT","readmeFilename":"readme.md"}