You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Moment.vue 554B

12345678910111213141516171819202122232425262728293031
  1. <!-- TODO: Move to vue components -->
  2. <template>
  3. <span class="live-relative-timestamp" :data-timestamp="timestamp * 1000" :title="title">{{ formatted }}</span>
  4. </template>
  5. <script>
  6. import moment from '@nextcloud/moment'
  7. export default {
  8. name: 'Moment',
  9. props: {
  10. timestamp: {
  11. type: Number,
  12. required: true,
  13. },
  14. format: {
  15. type: String,
  16. default: 'LLL',
  17. },
  18. },
  19. computed: {
  20. title() {
  21. return moment.unix(this.timestamp).format(this.format)
  22. },
  23. formatted() {
  24. return moment.unix(this.timestamp).fromNow()
  25. },
  26. },
  27. }
  28. </script>