Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

360
Views
Trying to get my clock to work in bootstrapvue - what am I doing wrong?

Hey guys these are my codes trying to get my clock to work in bootstrap vue. I want the time to show real time with the seconds moving. Dates work, and time works, but time is stationary. What am i doing wrong? Newbie..#thanks

    <template>
<div>
<div>
{{timestring}} 
</div>
<div>
{{timeclock}} 
</div>
</div>
</template>


<script>
data ()=> ({
timeString: '',
timeclock: '',
stopClock: false}),

    mounted () {
    this.nowTime();
    this.nowclock();
  },
  methods: {
    nowTime () {
      this.timeString = new Date(Date.now()).toLocaleDateString('en-US',
        { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' });
      if (!this.stopClock) {
        setTimeout(this.nowTime, 285);
      }
    },
    nowclock () {
      this.timeclock = +' ' + new Date(Date.now()).toLocaleTimeString('en-US');
      if (!this.stopClock) {
        setTimeout(this.nowTime, 285);
      }
    }
  },
  beforeDestroy () {
    this.stopClock = true;
  }
};
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You can just use setTimeout with 1000ms time interval with this.nowclock call back function

Codesandbox Demo

nowclock() {
  this.timeclock = +" " + new Date(Date.now()).toLocaleTimeString("en-US");
  if (!this.stopClock) setTimeout(this.nowclock, 1000);
},
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!