Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

https://github.com/vuejs-community/vue-filter-date-parse

Simple date parsing filter for Vue.js
https://github.com/vuejs-community/vue-filter-date-parse

parse vue vue-filter vue-filters vuejs vuejs2

Last synced: about 1 month ago
JSON representation

Simple date parsing filter for Vue.js

Lists

README

        

# @vuejs-community/vue-filter-date-parse
Simple date parsing filter for Vue.js

## Installation

install from npm
```bash
$ npm install @vuejs-community/vue-filter-date-parse
```
and register in you Vue app
```js
import Vue from 'vue';
import VueFilterDateParse from '@vuejs-community/vue-filter-date-parse';

Vue.use(VueFilterDateParse);
```

## Usage

Using with [dateFormat filter](https://github.com/vuejs-community/vue-filter-date-format):

```html

{{ '15.05.1967' | dateParse('DD.MM.YYYY') | dateFormat('YYYY-MM-DD') }}

```

or

```html

{{ '15.05.67' | dateParse('DD.MM.YY', { epoch: 1900 }) | dateFormat('YYYY-MM-DD') }}

```

render as:

```html

1967-05-15

```

## Format Options

| | Key | Input |
| ---------- | ------ | ----------------------- |
| **Year** | `YYYY` | 2000 2001 ... 2029 2030 |
| | `YY` | 00 01 ... 29 30 |
| **Month** | `MM` | 01 02 ... 11 12 |
| **Day** | `DD` | 01 02 ... 30 31 |
| **Hour** | `HH` | 00 01 ... 22 23 |
| **Minute** | `mm` | 00 01 ... 58 59 |
| **Second** | `ss` | 00 01 ... 58 59 |

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

## License

MIT © [Vue.js Community](https://github.com/vuejs-community)