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

639
Views
Luxon js get day from week day number

Moment had the option to get the day name based on week number (0 to 6). I see that luxon has day of the week, as number from 1-7 (Monday is 1, Sunday is 7)https://moment.github.io/luxon/#/parsing but I dont know how can I convert the week number to day name?

In moment

moment().day(0).format('ddddd'); // Sunday
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

I'd have a look at luxon's Info.weekdays, this will give day names in various formats.

However the day numbering is slightly different to Moment, so you'll have to translate.

const { Info } = luxon;
// moment.js days of week: Sunday: 0 -> Monday: 6
const momentDays = [0,1,2,3,4,5,6];

console.log('Index', 'Long', 'Short');
momentDays.forEach(day => {
    // Luxon day indexes are Monday: 0 -> Sunday 6
    const luxonDay = (day + 6) % 7;
    console.log(day, Info.weekdays('long')[luxonDay], Info.weekdays('short')[luxonDay]);
})
.as-console-wrapper { max-height: 100% !important; top: 0; }
<script src="https://cdnjs.cloudflare.com/ajax/libs/luxon/2.0.2/luxon.min.js" integrity="sha512-frUCURIeB0OKMPgmDEwT3rC4NH2a4gn06N3Iw6T1z0WfrQZd7gNfJFbHrNsZP38PVXOp6nUiFtBqVvmCj+ARhw==" crossorigin="anonymous" referrerpolicy="no-referrer"></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!