@bluemarble/bm-components 0.0.54 → 0.0.56

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/esm/index.js CHANGED
@@ -15304,8 +15304,18 @@ const Dialog = (_a) => {
15304
15304
 
15305
15305
  moment.locale('pt-br');
15306
15306
  function DateFormat(date) {
15307
+ const data = {
15308
+ utc: -3
15309
+ };
15310
+ if (date) {
15311
+ date = moment(date)
15312
+ .add(data.utc + 3, 'hours')
15313
+ .toDate();
15314
+ }
15307
15315
  function momentWithDate(utc = false) {
15308
- return Object.assign(Object.assign({}, moment(date).utc(utc)), { toDateOrUndefined: () => !date ? undefined : moment(date).utc(utc).toDate() });
15316
+ const current = moment(date).utc(utc);
15317
+ current.toDateOrUndefined = () => !date ? undefined : moment(date).utc(utc).toDate();
15318
+ return current;
15309
15319
  }
15310
15320
  function convertDateFromClient(forceUTC = undefined) {
15311
15321
  let utc = forceUTC || true;
@@ -15313,18 +15323,26 @@ function DateFormat(date) {
15313
15323
  utc = false;
15314
15324
  return Object.assign(Object.assign({}, momentWithDate(utc)), { toDateOrUndefined: () => !date ? undefined : momentWithDate(utc).toDate() });
15315
15325
  }
15326
+ function now() {
15327
+ if (process.env.NODE_ENV === 'development') {
15328
+ return moment()
15329
+ .add(data.utc + 3, 'hours')
15330
+ .utc(true);
15331
+ }
15332
+ return moment().add(data.utc, 'hours');
15333
+ }
15316
15334
  return {
15317
15335
  from: {
15318
15336
  db: momentWithDate(),
15319
15337
  client: convertDateFromClient()
15338
+ },
15339
+ now,
15340
+ utc: (newUTC) => {
15341
+ data.utc = newUTC;
15342
+ return DateFormat(date);
15320
15343
  }
15321
15344
  };
15322
- }
15323
- DateFormat.now = () => {
15324
- if (process.env.NODE_ENV === 'development')
15325
- return moment().utc(true);
15326
- return moment().subtract(3, 'hours');
15327
- };
15345
+ }
15328
15346
 
15329
15347
  function RouteHelper(methods, middlewares = []) {
15330
15348
  return (req, res) => {