importação do dayjs como função

This commit is contained in:
Luiz Silva 2025-10-26 21:19:21 -03:00
parent 1d969c9b0d
commit 2cac8492fa
6 changed files with 99 additions and 65 deletions

View file

@ -1,9 +1,7 @@
"use strict"; "use strict";
var __create = Object.create;
var __defProp = Object.defineProperty; var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames; var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty; var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => { var __export = (target, all) => {
for (var name in all) for (var name in all)
@ -17,43 +15,25 @@ var __copyProps = (to, from, except, desc) => {
} }
return to; return to;
}; };
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var dayjs_exports = {}; var dayjs_exports = {};
__export(dayjs_exports, { __export(dayjs_exports, {
dayjs: () => import_dayjs.default, criarDayjsbr: () => criarDayjsbr
dayjsbr: () => dayjsbr,
default: () => dayjs_default
}); });
module.exports = __toCommonJS(dayjs_exports); module.exports = __toCommonJS(dayjs_exports);
var import_dayjs = __toESM(require("dayjs")); const criarDayjsbr = (edayjs, op) => {
var import_duration = __toESM(require("dayjs/plugin/duration")); edayjs.extend(op.utc);
var import_isSameOrAfter = __toESM(require("dayjs/plugin/isSameOrAfter")); edayjs.extend(op.timezone);
var import_isSameOrBefore = __toESM(require("dayjs/plugin/isSameOrBefore")); edayjs.extend(op.weekOfYear);
var import_minMax = __toESM(require("dayjs/plugin/minMax")); edayjs.extend(op.isSameOrBefore);
var import_relativeTime = __toESM(require("dayjs/plugin/relativeTime")); edayjs.extend(op.isSameOrAfter);
var import_timezone = __toESM(require("dayjs/plugin/timezone")); edayjs.extend(op.minMax);
var import_utc = __toESM(require("dayjs/plugin/utc")); edayjs.extend(op.relativeTime);
var import_weekOfYear = __toESM(require("dayjs/plugin/weekOfYear")); edayjs.extend(op.duration);
import_dayjs.default.extend(import_utc.default); edayjs.locale("pt-br");
import_dayjs.default.extend(import_timezone.default); return edayjs;
import_dayjs.default.extend(import_weekOfYear.default); };
import_dayjs.default.extend(import_isSameOrBefore.default);
import_dayjs.default.extend(import_isSameOrAfter.default);
import_dayjs.default.extend(import_minMax.default);
import_dayjs.default.extend(import_relativeTime.default);
import_dayjs.default.extend(import_duration.default);
const dayjsbr = import_dayjs.default;
var dayjs_default = dayjsbr;
// Annotate the CommonJS export names for ESM import in node: // Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = { 0 && (module.exports = {
dayjs, criarDayjsbr
dayjsbr
}); });

View file

@ -1,6 +1,13 @@
import z from 'zod'; import z from 'zod';
import dayjs from 'dayjs'; import dayjs from 'dayjs';
export { ManipulateType, default as 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 { v4 } from 'uuid'; import { v4 } from 'uuid';
declare const aleatorio: (tamanho?: number) => string; declare const aleatorio: (tamanho?: number) => string;
@ -90,7 +97,32 @@ declare const zFiltro: z.ZodObject<{
ou: z.ZodOptional<z.ZodBoolean>; ou: z.ZodOptional<z.ZodBoolean>;
}, z.core.$strip>; }, z.core.$strip>;
declare const dayjsbr: typeof dayjs; /**
*
* 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"
*/
declare 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;
}) => typeof dayjs;
declare const cdn_carro_de_boi = "https://carro-de-boi-idz-one.b-cdn.net"; declare const cdn_carro_de_boi = "https://carro-de-boi-idz-one.b-cdn.net";
@ -311,4 +343,4 @@ declare const nomeVariavel: (v: {
[key: string]: any; [key: string]: any;
}) => string; }) => string;
export { TipagemRotas, type TipoLoggerSessao, aleatorio, cacheM, cacheMFixo, cacheMemoria, camposComuns, cdn_carro_de_boi, dayjsbr, defineCwd, erUuid, esperar, extensoes, graficos_pilao, type interfaceConsulta, localValor, logger, nomeVariavel, objetoPg, operadores, paraObjetoRegistroPg, pgObjeto, postLogger, siglas_unidades_medida, texto_busca, tipoArquivo, type tipoFiltro, type tipoLogger, type tipoLoggerLog, type tipoLokiObjeto, tipoUsuarioResiduos, tx, umaFuncao, umaVariavel, unidades_medida, uuid, uuidV3, uuidV4, uuid_null, validarUuid, verCacheM, zFiltro, zOperadores }; export { TipagemRotas, type TipoLoggerSessao, aleatorio, cacheM, cacheMFixo, cacheMemoria, camposComuns, cdn_carro_de_boi, criarDayjsbr, defineCwd, erUuid, esperar, extensoes, graficos_pilao, type interfaceConsulta, localValor, logger, nomeVariavel, objetoPg, operadores, paraObjetoRegistroPg, pgObjeto, postLogger, siglas_unidades_medida, texto_busca, tipoArquivo, type tipoFiltro, type tipoLogger, type tipoLoggerLog, type tipoLokiObjeto, tipoUsuarioResiduos, tx, umaFuncao, umaVariavel, unidades_medida, uuid, uuidV3, uuidV4, uuid_null, validarUuid, verCacheM, zFiltro, zOperadores };

File diff suppressed because one or more lines are too long

View file

@ -1,6 +1,6 @@
{ {
"name": "p-comuns", "name": "p-comuns",
"version": "0.256.0", "version": "0.258.0",
"description": "", "description": "",
"main": "./dist-back/index.js", "main": "./dist-back/index.js",
"module": "./dist-front/index.mjs", "module": "./dist-front/index.mjs",

Binary file not shown.

View file

@ -1,32 +1,54 @@
// dayjsbr.ts // dayjsbr.ts
import dayjs from "dayjs" import type dayjs from "dayjs"
import type duration from "dayjs/plugin/duration"
//import "dayjs/locale/pt-br" //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"
import duration from "dayjs/plugin/duration" /**
import isSameOrAfter from "dayjs/plugin/isSameOrAfter" *
import isSameOrBefore from "dayjs/plugin/isSameOrBefore" * dayjsbr.ts
import minMax from "dayjs/plugin/minMax" *import dayjs from "dayjs"
import relativeTime from "dayjs/plugin/relativeTime" *import "dayjs/locale/pt-br"
import timezone from "dayjs/plugin/timezone" *import duration from "dayjs/plugin/duration"
import utc from "dayjs/plugin/utc" *import isSameOrAfter from "dayjs/plugin/isSameOrAfter"
import weekOfYear from "dayjs/plugin/weekOfYear" *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"
// ordem dos extends (utc antes de timezone)
dayjs.extend(utc)
dayjs.extend(timezone)
dayjs.extend(weekOfYear)
dayjs.extend(isSameOrBefore)
dayjs.extend(isSameOrAfter)
dayjs.extend(minMax)
dayjs.extend(relativeTime)
dayjs.extend(duration)
//dayjs.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")
export const dayjsbr = dayjs return edayjs
export default dayjsbr }
// útil para tipagens em chamadas de add/subtract etc.
export type { ManipulateType } from "dayjs"
export { dayjs }