set dates

This commit is contained in:
Mutasem 2021-07-08 16:44:55 +02:00
parent dde31addd7
commit 75061780cd
3 changed files with 23 additions and 11 deletions

View file

@ -0,0 +1,17 @@
<template functional>
<span>
{{$options.format(props.date)}}
</span>
</template>
<script lang="ts">
import Vue from 'vue';
import { format } from 'timeago.js';
export default Vue.extend({
name: 'UpdatesPanel',
props: ['date'],
format,
});
</script>

View file

@ -11,7 +11,7 @@
</template> </template>
<template slot="content"> <template slot="content">
<section :class="$style['description']"> <section :class="$style['description']">
<p v-if="currentVersion">Youre on {{ currentVersion.name }}, which was released <strong>{{currentReleaseDate}}</strong> and is <strong> {{ nextVersions.length }} version{{nextVersions.length > 1 ? 's' : ''}}</strong> behind the latest and greatest n8n</p> <p v-if="currentVersion">Youre on {{ currentVersion.name }}, which was released <strong><TimeAgo :date="currentVersion.createdAt" /></strong> and is <strong> {{ nextVersions.length }} version{{nextVersions.length > 1 ? 's' : ''}}</strong> behind the latest and greatest n8n</p>
<a :class="$style.update" :href="infoUrl" v-if="infoUrl" target="_blank"> <a :class="$style.update" :href="infoUrl" v-if="infoUrl" target="_blank">
<font-awesome-icon icon="info-circle"></font-awesome-icon> <font-awesome-icon icon="info-circle"></font-awesome-icon>
@ -33,9 +33,9 @@
<script lang="ts"> <script lang="ts">
import Vue from 'vue'; import Vue from 'vue';
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
import { format } from 'timeago.js';
import Modal from './Modal.vue'; import Modal from './Modal.vue';
import TimeAgo from './TimeAgo.vue';
import VersionCard from './VersionCard.vue'; import VersionCard from './VersionCard.vue';
export default Vue.extend({ export default Vue.extend({
@ -43,6 +43,7 @@ export default Vue.extend({
components: { components: {
Modal, Modal,
VersionCard, VersionCard,
TimeAgo,
}, },
props: ['modalName', 'visible'], props: ['modalName', 'visible'],
computed: { computed: {
@ -51,9 +52,6 @@ export default Vue.extend({
'currentVersion', 'currentVersion',
'infoUrl', 'infoUrl',
]), ]),
currentReleaseDate() {
return format(this.currentVersion.createdAt);
},
}, },
}); });
</script> </script>

View file

@ -13,7 +13,7 @@
<el-tag v-if="version.hasBreakingChange" size="small" :class="`${$style['breaking-change']} ${$style['badge']}`">Breaking changes</el-tag> <el-tag v-if="version.hasBreakingChange" size="small" :class="`${$style['breaking-change']} ${$style['badge']}`">Breaking changes</el-tag>
</div> </div>
<div :class="$style.released"> <div :class="$style.released">
Released {{releaseDate}} Released&nbsp;<TimeAgo :date="version.createdAt" />
</div> </div>
</div> </div>
<div> <div>
@ -31,19 +31,16 @@
<script lang="ts"> <script lang="ts">
import Vue from 'vue'; import Vue from 'vue';
import { format } from 'timeago.js';
import NodeIcon from './NodeIcon.vue'; import NodeIcon from './NodeIcon.vue';
import { IVersion } from '@/Interface'; import { IVersion } from '@/Interface';
import TimeAgo from './TimeAgo.vue';
export default Vue.extend({ export default Vue.extend({
components: { NodeIcon }, components: { NodeIcon, TimeAgo },
name: 'UpdatesPanel', name: 'UpdatesPanel',
props: ['version'], props: ['version'],
computed: { computed: {
releaseDate() {
return format(this.version.createdAt);
},
hasMoreThan2Rows(): boolean { hasMoreThan2Rows(): boolean {
const version = this.version as IVersion; const version = this.version as IVersion;
return version.nodes && version.nodes.length > 20; return version.nodes && version.nodes.length > 20;