Skip to content

Commit

Permalink
Use useNow in ElapsedTime component
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexVelezLl committed Jun 28, 2024
1 parent 704bf36 commit ed3d1a6
Showing 1 changed file with 5 additions and 13 deletions.
18 changes: 5 additions & 13 deletions kolibri/core/assets/src/views/ElapsedTime.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,20 @@

<script>
import { now } from 'kolibri.utils.serverClock';
import useNow from 'kolibri.coreVue.composables.useNow';
export default {
name: 'ElapsedTime',
setup() {
const { now } = useNow();
return { now };
},
props: {
date: {
type: Date,
default: null,
},
},
data: () => ({
now: now(),
timer: null,
}),
computed: {
ceilingDate() {
if (this.date > this.now) {
Expand All @@ -29,14 +29,6 @@
return this.date;
},
},
mounted() {
this.timer = setInterval(() => {
this.now = now();
}, 10000);
},
beforeDestroy() {
clearInterval(this.timer);
},
};
</script>
Expand Down

0 comments on commit ed3d1a6

Please sign in to comment.