Skip to content

Instantly share code, notes, and snippets.

@seanbuscay
Created February 25, 2017 19:26
Show Gist options
  • Save seanbuscay/cbe3a686c9021d32f408b9989e74b666 to your computer and use it in GitHub Desktop.
Save seanbuscay/cbe3a686c9021d32f408b9989e74b666 to your computer and use it in GitHub Desktop.

Revisions

  1. Sean Buscay revised this gist Feb 25, 2017. 1 changed file with 26 additions and 0 deletions.
    26 changes: 26 additions & 0 deletions vue.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,26 @@
    new Vue({
    el: '#app',
    data: {
    items: [ // unix timestamps
    1481889223,
    1452945223,
    1450871623,
    undefined,
    1450353223,
    1450270423,
    ]
    },
    methods: {
    moment: function (date) {
    return moment(date);
    },
    date: function (date) {
    return moment(date).format('MMMM Do YYYY, h:mm:ss a');
    }
    },
    filters: {
    moment: function (date) {
    return moment(date).format('MMMM Do YYYY, h:mm:ss a');
    }
    }
    })
  2. Sean Buscay created this gist Feb 25, 2017.
    9 changes: 9 additions & 0 deletions vue.html
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,9 @@
    <div id="app">
    <ul>
    <li v-for="item in items">
    <p>{{ moment(item).format('MMMM Do YYYY, h:mm:ss a') }}</p>
    <p class="method">{{ date(item) }}</p>
    <p class="filter">{{ item | moment }}</p>
    </li>
    </ul>
    </div>