mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-11-29 01:34:05 +00:00
33 lines
724 B
Vue
33 lines
724 B
Vue
<template>
|
|
<span>{{ displayText }}</span>
|
|
</template>
|
|
|
|
<script>
|
|
import dayjs from "dayjs";
|
|
import relativeTime from "dayjs/plugin/relativeTime";
|
|
import timezone from "dayjs/plugin/timezone"; // dependent on utc plugin
|
|
import utc from "dayjs/plugin/utc";
|
|
dayjs.extend(utc);
|
|
dayjs.extend(timezone);
|
|
dayjs.extend(relativeTime);
|
|
|
|
export default {
|
|
props: {
|
|
value: String,
|
|
dateOnly: {
|
|
type: Boolean,
|
|
default: false,
|
|
},
|
|
},
|
|
|
|
computed: {
|
|
displayText() {
|
|
if (this.dateOnly) {
|
|
return this.$root.date(this.value);
|
|
} else {
|
|
return this.$root.datetime(this.value);
|
|
}
|
|
},
|
|
},
|
|
};
|
|
</script>
|