Clock update instantly + slower interval

This commit is contained in:
Jörn-Michael Miehe 2022-09-11 22:49:17 +00:00
parent 042f5f6b18
commit bdeaa9a561

View file

@ -14,12 +14,15 @@ export default class Clock extends Vue {
@Prop() @Prop()
public format!: string; public format!: string;
private update(): void {
this.formatted = DateTime.now()
.setLocale(navigator.language)
.toFormat(this.format);
}
public created(): void { public created(): void {
this.interval = setInterval((): void => { this.update();
this.formatted = DateTime.now() this.interval = setInterval(this.update, 10000);
.setLocale(navigator.language)
.toFormat(this.format);
}, 1000);
} }
public beforeDestroy(): void { public beforeDestroy(): void {