summaryrefslogtreecommitdiffstats
path: root/src/components/Datetime.vue
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/Datetime.vue')
-rw-r--r--src/components/Datetime.vue30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/components/Datetime.vue b/src/components/Datetime.vue
new file mode 100644
index 0000000..0d4e182
--- /dev/null
+++ b/src/components/Datetime.vue
@@ -0,0 +1,30 @@
+<template>
+ <span>{{ displayText }}</span>
+</template>
+
+<script>
+export default {
+ props: {
+ /** Value of date time */
+ value: {
+ type: String,
+ default: null,
+ },
+ /** Should only the date be displayed? */
+ dateOnly: {
+ type: Boolean,
+ default: false,
+ },
+ },
+
+ computed: {
+ displayText() {
+ if (this.dateOnly) {
+ return this.$root.date(this.value);
+ } else {
+ return this.$root.datetime(this.value);
+ }
+ },
+ },
+};
+</script>