Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

346
Visualizações
TypeError: (0 , _dayjs.Dayjs) is not a function

I want to replace momentjs with dayjs right now. First I added the dependencies:

"dayjs":"1.10.7"

then import the dayjs like this:

import { Dayjs } from 'dayjs';

get the month start using this code snip:

const fullDateTimeFormat = 'YYYY-MM-DD HH:mm:ss:SSS';
const startOfCurrentMonth = Dayjs().startOf("month").format(fullDateTimeFormat);

but show me this error:

TypeError: (0 , _dayjs.Dayjs) is not a function
selectMonthListState
src/components/SelectData/index.js:112
  109 | const days = getMonthDay(year, month);
  110 | const prevMonthDays = getMonthDay(year, month-1);
  111 | const startDateValue = `${moment(year + '-' + (month-count +1) + '-01').format(dateFormat)} 00:00:00:000`;
> 112 | const startOfCurrentMonth = Dayjs().startOf("month").format(fullDateTimeFormat);
      | ^  113 | const endDateValue = count ===1? `${moment(year + '-' + (month)  + '-' + prevMonthDays).format(dateFormat)} 23:59:59:999`: `${moment(year + '-' + (month+1)  + '-' + days).format(dateFormat)} 23:59:59:999`;
  114 | 
  115 | setSelectDate([moment(startDateValue, rPickerFormat), moment(endDateValue, rPickerFormat)]);

what should I do to fix this problem? Am I missing something?

about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

I using it like this:

import  dayjs  from 'dayjs';

const startOfCurrentMonth = dayjs().startOf("month").format(fullDateTimeFormat);

works.

about 4 years ago · Juan Pablo Isaza Relatório

0

try this:

import dayjs from 'dayjs';
const relativeTime = require('dayjs/plugin/relativeTime');
dayjs.extend(relativeTime);
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda