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

161
Views
get the Days of persian Month in dayjs package

i write a function for getting days of month . i use dayjs and jalaliday for build this function .

My code:

import dayjs from "dayjs";
import jalaliday from 'jalaliday'

dayjs.extend(jalaliday)
dayjs.calendar('jalali').locale('fa')
export function GetMonth(month =dayjs().month()){
    const year = dayjs().year();
    
    const FirstDayOfTheMonth= dayjs(new Date(year ,month,1)).calendar('jalali').day();
    let CurrentMonthCount =0 -FirstDayOfTheMonth;
    const DaysMatrix =new Array(5).fill([]).map(()=>{
        return new Array(7).fill(null).map(()=>{
                CurrentMonthCount++
                return dayjs(new Date(year,month,CurrentMonthCount)).calendar('jalali').locale('fa')
        })
    });
    return DaysMatrix; 
}

i use this function in my react component and, when i log this function it get's me english date like this :

my consol.table(GetMonth())

only the year is correct. how can i get persian date details.

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

0

try this Man :

import dayjs from "dayjs";
import jalaliday from 'jalaliday'
dayjs.extend(jalaliday)
export function GetMonth(month = dayjs().month()+1) {
    const year = dayjs().year();

    const FirstDayOfTheMonth = dayjs(new Date(year, month, 1)).day();
    let CurrentMonthCount = 0 - FirstDayOfTheMonth;
    const DaysMatrix = new Array(5).fill([]).map(() => {
        return new Array(7).fill(null).map(() => {
            CurrentMonthCount++
            return dayjs(new Date(year,month,CurrentMonthCount)).calendar('jalali').locale('fa').format('DD MMMM YYYY')
        })
    });
    return DaysMatrix
}
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!