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

202
Views
How to check if date is a current date with using dayjs?

I have a problem with checking if my date in unix is a current date with using dayjs library, I try like below:

const date = 1631978008; //today: 2021-09-18
const isToday = dayjs().isSame(date, 'day'); //return false

but always return me false when my date is a today date, can someone tell me why? it should return true :/

thanks for any help!

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You can use the unix function to parse the unix timestamp in seconds before comparing it with the current time.

const date = 1631978008; //today: 2021-09-18
const isToday = dayjs().isSame(dayjs.unix(date), 'day'); 

console.log(isToday);
<script src="https://unpkg.com/dayjs@1.8.21/dayjs.min.js"></script>

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!