.
This commit is contained in:
parent
21a1b27d35
commit
4ed3d82bb2
9 changed files with 49 additions and 143 deletions
30
src/dayjs.ts
30
src/dayjs.ts
|
|
@ -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 }
|
||||
|
|
@ -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 = ({
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue