This commit is contained in:
Luiz Silva 2026-02-19 13:26:52 -03:00
parent 21a1b27d35
commit 4ed3d82bb2
9 changed files with 49 additions and 143 deletions

View file

@ -1,30 +0,0 @@
import type { Dayjs } from "dayjs"
import dayjs from "dayjs"
const dayjsbr = dayjs
export type { ManipulateType } from "dayjs"
import duration from "dayjs/plugin/duration"
import isSameOrAfter from "dayjs/plugin/isSameOrAfter"
import isSameOrBefore from "dayjs/plugin/isSameOrBefore"
import minMax from "dayjs/plugin/minMax"
import relativeTime from "dayjs/plugin/relativeTime"
import timezone from "dayjs/plugin/timezone"
import utc from "dayjs/plugin/utc"
import weekOfYear from "dayjs/plugin/weekOfYear"
import "dayjs/locale/pt-br"
dayjsbr.locale("pt-br")
dayjsbr.extend(utc)
dayjsbr.extend(timezone)
dayjsbr.extend(weekOfYear)
dayjsbr.extend(isSameOrBefore)
dayjsbr.extend(isSameOrAfter)
dayjsbr.extend(minMax)
dayjsbr.extend(relativeTime)
dayjsbr.extend(duration)
export { dayjsbr }
export type { Dayjs }

View file

@ -40,30 +40,29 @@ import type _weekOfYear from "dayjs/plugin/weekOfYear"
* @example
* ```ts
* // Em seu arquivo de configuração (ex: plugins/dayjs.ts):
* import dayjs from "dayjs";
* import duration from "dayjs/plugin/duration";
* import isSameOrAfter from "dayjs/plugin/isSameOrAfter";
* import isSameOrBefore from "dayjs/plugin/isSameOrBefore";
* import minMax from "dayjs/plugin/minMax";
* import relativeTime from "dayjs/plugin/relativeTime";
* import timezone from "dayjs/plugin/timezone";
* import utc from "dayjs/plugin/utc";
* import weekOfYear from "dayjs/plugin/weekOfYear";
* import "dayjs/locale/pt-br"; // Importante: importar o locale!
*
* import { defineDayjsBr } from "@comuns/src/dayjs26";
*
* export const dayjsbr = defineDayjsBr({
* dayjs,
* duration,
* isSameOrAfter,
* isSameOrBefore,
* minMax,
* relativeTime,
* timezone,
* utc,
* weekOfYear,
* });
* import dayjs from "dayjs"
* import duration from "dayjs/plugin/duration"
* import isSameOrAfter from "dayjs/plugin/isSameOrAfter"
* import isSameOrBefore from "dayjs/plugin/isSameOrBefore"
* import minMax from "dayjs/plugin/minMax"
* import relativeTime from "dayjs/plugin/relativeTime"
* import timezone from "dayjs/plugin/timezone"
* import utc from "dayjs/plugin/utc"
* import weekOfYear from "dayjs/plugin/weekOfYear"
* import { defineDayjsBr } from "p-comuns"
* import "dayjs/locale/pt-br" // Importante: importar o locale!
* export const dayjsbr = defineDayjsBr({
* dayjs,
* duration,
* isSameOrAfter,
* isSameOrBefore,
* minMax,
* relativeTime,
* timezone,
* utc,
* weekOfYear,
* })
* ```
*/
const defineDayjsBr = ({

View file

@ -2,7 +2,6 @@ export * from "./aleatorio"
export * from "./cacheMemoria"
export * from "./constantes"
export * from "./consulta"
export * from "./dayjs"
export * from "./dayjs26"
export * from "./ecosistema"
export * from "./extensoes"