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

224
Views
DataTable.js row color formatting date range

I would like to format row in my table according to their dates. I would like date in a certain range (x to u) to have a certain format, range (x to o) another format and all date before x another one like ( x and all before that)

rowCallback: function (row, data, index) {
   if (data[4] == [moment("MM-DD-YYYY").subtract(1, 'days'), moment("MM-DD-YYYY").subtract(4, 'month').startOf('month')]) {
       $(row).find('td:eq(4)').addClass('expired')
   } else if (data[4] == [moment("MM-DD-YYYY"), moment("MM-DD-YYYY").add(7, 'days')]) {
       $(row).find('td:eq(4)').addClass('oneweek')
   } else if (data[4] == [moment("MM-DD-YYYY"), moment("MM-DD-YYYY").add(4, 'weeks')]) {
       $(row).find('td:eq(4)').addClass('fourweek')
   }
}
about 4 years ago · Juan Pablo Isaza
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!