1.2.0 • Published 1 year ago

@vuejs-community/vue-filter-date-parse v1.2.0

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

@vuejs-community/vue-filter-date-parse

Simple date parsing filter for Vue.js

Installation

install from npm

$ npm install @vuejs-community/vue-filter-date-parse

and register in you Vue app

import Vue from 'vue';
import VueFilterDateParse from '@vuejs-community/vue-filter-date-parse';

Vue.use(VueFilterDateParse);

Usage

Using with dateFormat filter:

<template>
  <div>{{ '15.05.1967' | dateParse('DD.MM.YYYY') | dateFormat('YYYY-MM-DD') }}</div>
</template>

or

<template>
  <div>{{ '15.05.67' | dateParse('DD.MM.YY', { epoch: 1900 }) | dateFormat('YYYY-MM-DD') }}</div>
</template>

render as:

<div>1967-05-15</div>

Format Options

KeyInput
YearYYYY2000 2001 ... 2029 2030
YY00 01 ... 29 30
MonthMM01 02 ... 11 12
DayDD01 02 ... 30 31
HourHH00 01 ... 22 23
Minutemm00 01 ... 58 59
Secondss00 01 ... 58 59

Default format is YYYY-MM-DD HH:mm:ss

License

MIT © Vue.js Community