DatetimeTZ should allow formatting date only

This commit is contained in:
Matthias 2021-12-25 10:01:50 +01:00
parent f344b211f6
commit 1578881e86

View File

@ -3,7 +3,7 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import { timestampms, timestampmsWithTimezone } from '@/shared/formatters'; import { timestampms, timestampmsWithTimezone, timestampToDateString } from '@/shared/formatters';
import { Component, Prop, Vue } from 'vue-property-decorator'; import { Component, Prop, Vue } from 'vue-property-decorator';
@Component({}) @Component({})
@ -12,9 +12,14 @@ export default class DateTimeTZ extends Vue {
@Prop({ required: false, type: Boolean, default: false }) showTimezone!: boolean; @Prop({ required: false, type: Boolean, default: false }) showTimezone!: boolean;
@Prop({ required: false, type: Boolean, default: false }) dateOnly!: boolean;
timestampms = timestampms; timestampms = timestampms;
get formattedDate(): string { get formattedDate(): string {
if (this.dateOnly) {
return timestampToDateString(this.date);
}
if (this.showTimezone) { if (this.showTimezone) {
return timestampmsWithTimezone(this.date); return timestampmsWithTimezone(this.date);
} }