feat: Change the date format display in widget (#1528)
Co-authored-by: Pranav <pranav@chatwoot.com>
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
<template>
|
||||
<div class="date--separator">
|
||||
{{ date }}
|
||||
{{ formattedDate }}
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { formatDate } from 'shared/helpers/DateHelper';
|
||||
export default {
|
||||
props: {
|
||||
date: {
|
||||
@@ -12,6 +13,15 @@ export default {
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
formattedDate() {
|
||||
return formatDate({
|
||||
date: this.date,
|
||||
todayText: this.$t('TODAY'),
|
||||
yesterdayText: this.$t('YESTERDAY'),
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
import { mount } from '@vue/test-utils';
|
||||
import DateSeparator from '../DateSeparator';
|
||||
|
||||
describe('Spinner', () => {
|
||||
describe('DateSeparator', () => {
|
||||
test('matches snapshot', () => {
|
||||
const wrapper = mount(DateSeparator, {
|
||||
propsData: {
|
||||
date: 'Nov 18, 2019',
|
||||
},
|
||||
mocks: {
|
||||
$t: () => {},
|
||||
},
|
||||
});
|
||||
expect(wrapper.isVueInstance()).toBeTruthy();
|
||||
expect(wrapper.element).toMatchSnapshot();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`Spinner matches snapshot 1`] = `
|
||||
exports[`DateSeparator matches snapshot 1`] = `
|
||||
<div
|
||||
class="date--separator"
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user