Skip to content

Commit

Permalink
fix(): set locale pt, pt-br correct weekdays and months (#1697)
Browse files Browse the repository at this point in the history
  • Loading branch information
SrBrahma committed Feb 28, 2022
1 parent 9a43708 commit e019301
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions src/locale/pt-br.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import dayjs from 'dayjs'

const locale = {
name: 'pt-br',
weekdays: 'Domingo_Segunda-feira_Terça-feira_Quarta-feira_Quinta-feira_Sexta-feira_Sábado'.split('_'),
weekdaysShort: 'Dom_Seg_Ter_Qua_Qui_Sex_Sáb'.split('_'),
weekdays: 'domingo_segunda-feira_terça-feira_quarta-feira_quinta-feira_sexta-feira_sábado'.split('_'),
weekdaysShort: 'dom_seg_ter_qua_qui_sex_sáb'.split('_'),
weekdaysMin: 'Do_2ª_3ª_4ª_5ª_6ª_Sá'.split('_'),
months: 'Janeiro_Fevereiro_Março_Abril_Maio_Junho_Julho_Agosto_Setembro_Outubro_Novembro_Dezembro'.split('_'),
monthsShort: 'Jan_Fev_Mar_Abr_Mai_Jun_Jul_Ago_Set_Out_Nov_Dez'.split('_'),
months: 'janeiro_fevereiro_março_abril_maio_junho_julho_agosto_setembro_outubro_novembro_dezembro'.split('_'),
monthsShort: 'jan_fev_mar_abr_mai_jun_jul_ago_set_out_nov_dez'.split('_'),
ordinal: n => `${n}º`,
formats: {
LT: 'HH:mm',
Expand Down
8 changes: 4 additions & 4 deletions src/locale/pt.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import dayjs from 'dayjs'

const locale = {
name: 'pt',
weekdays: 'Domingo_Segunda-feira_Terça-feira_Quarta-feira_Quinta-feira_Sexta-feira_Sábado'.split('_'),
weekdaysShort: 'Dom_Seg_Ter_Qua_Qui_Sex_Sab'.split('_'),
weekdays: 'domingo_segunda-feira_terça-feira_quarta-feira_quinta-feira_sexta-feira_sábado'.split('_'),
weekdaysShort: 'dom_seg_ter_qua_qui_sex_sab'.split('_'),
weekdaysMin: 'Do_2ª_3ª_4ª_5ª_6ª_Sa'.split('_'),
months: 'Janeiro_Fevereiro_Março_Abril_Maio_Junho_Julho_Agosto_Setembro_Outubro_Novembro_Dezembro'.split('_'),
monthsShort: 'Jan_Fev_Mar_Abr_Mai_Jun_Jul_Ago_Set_Out_Nov_Dez'.split('_'),
months: 'janeiro_fevereiro_março_abril_maio_junho_julho_agosto_setembro_outubro_novembro_dezembro'.split('_'),
monthsShort: 'jan_fev_mar_abr_mai_jun_jul_ago_set_out_nov_dez'.split('_'),
ordinal: n => `${n}º`,
weekStart: 1,
yearStart: 4,
Expand Down

1 comment on commit e019301

@juniorvilas
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I start to get this error

{
inicialDate: M {
'$L': 'en',
'$u': undefined,
'$d': 2024-03-02T16:00:28.320Z,
'$y': 2024,
'$M': 2,
'$D': 2,
'$W': 6,
'$H': 13,
'$m': 0,
'$s': 28,
'$ms': 320,
'$x': {},
'$isDayjsObject': true
},
finalDate: M {
'$L': 'en',
'$u': undefined,
'$d': 2024-03-02T16:00:28.320Z,
'$y': 2024,
'$M': 2,
'$D': 2,
'$W': 6,
'$H': 13,
'$m': 0,
'$s': 28,
'$ms': 320,
'$x': {},
'$isDayjsObject': true
}
}
Your locale has not been found.
Either the locale key is not a supported one. Locales supported by dayjs are available here: https://github.com/iamkun/dayjs/tree/dev/src/locale
Or you forget to import the locale from 'dayjs/locale/{localeUsed}'
fallback on English locale

my config on dayjs.ts, im use NEXTjs 14

import dayjs from "dayjs";
import utc from "dayjs/plugin/utc";

import "dayjs/locale/pt-br";

dayjs.locale("pt-br");
dayjs.extend(utc);

Please sign in to comment.