internalização de libs

This commit is contained in:
Luiz Silva 2025-10-26 21:28:59 -03:00
parent 2cac8492fa
commit 42d5e978c9
7 changed files with 78 additions and 105 deletions

View file

@ -1,54 +1,24 @@
// dayjsbr.ts
import type dayjs from "dayjs"
import dayjsbr from "dayjs"
import type duration from "dayjs/plugin/duration"
//import "dayjs/locale/pt-br"
import type isSameOrAfter from "dayjs/plugin/isSameOrAfter"
import type isSameOrBefore from "dayjs/plugin/isSameOrBefore"
import type minMax from "dayjs/plugin/minMax"
import type relativeTime from "dayjs/plugin/relativeTime"
import type timezone from "dayjs/plugin/timezone"
import type utc from "dayjs/plugin/utc"
import type weekOfYear from "dayjs/plugin/weekOfYear"
export type { ManipulateType } from "dayjs"
import "dayjs/locale/pt-br"
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"
/**
*
* dayjsbr.ts
*import dayjs from "dayjs"
*import "dayjs/locale/pt-br"
*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"
dayjsbr.extend(utc)
dayjsbr.extend(timezone)
dayjsbr.extend(weekOfYear)
dayjsbr.extend(isSameOrBefore)
dayjsbr.extend(isSameOrAfter)
dayjsbr.extend(minMax)
dayjsbr.extend(relativeTime)
dayjsbr.extend(duration)
dayjsbr.locale("pt-br")
*/
export const criarDayjsbr = (
edayjs: typeof dayjs,
op: {
duration: typeof duration
isSameOrAfter: typeof isSameOrAfter
isSameOrBefore: typeof isSameOrBefore
minMax: typeof minMax
relativeTime: typeof relativeTime
timezone: typeof timezone
utc: typeof utc
weekOfYear: typeof weekOfYear
},
) => {
edayjs.extend(op.utc)
edayjs.extend(op.timezone)
edayjs.extend(op.weekOfYear)
edayjs.extend(op.isSameOrBefore)
edayjs.extend(op.isSameOrAfter)
edayjs.extend(op.minMax)
edayjs.extend(op.relativeTime)
edayjs.extend(op.duration)
edayjs.locale("pt-br")
return edayjs
}
export { dayjsbr }