Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@nocobase/utils

Package Overview
Dependencies
Maintainers
0
Versions
439
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nocobase/utils - npm Package Compare versions

Comparing version 1.3.39-beta to 1.4.0-alpha

1

lib/date.d.ts

@@ -38,1 +38,2 @@ /**

export declare function offsetFromString(string: string | number): number;
export declare const getPickerFormat: (picker: any) => "YYYY-MM" | "YYYY" | "YYYY[W]W" | "YYYY-MM-DD" | "YYYY[Q]Q";

45

lib/date.js

@@ -41,2 +41,3 @@ /**

getDefaultFormat: () => getDefaultFormat,
getPickerFormat: () => getPickerFormat,
moment2str: () => moment2str,

@@ -68,3 +69,3 @@ offsetFromString: () => offsetFromString,

} else if (props["picker"] === "week") {
return "YYYY-wo";
return "YYYY[W]W";
}

@@ -90,2 +91,7 @@ return props["showTime"] ? "YYYY-MM-DD HH:mm:ss" : "YYYY-MM-DD";

}, "toLocal");
const convertQuarterToFirstDay = /* @__PURE__ */ __name((quarterStr) => {
const year = parseInt(quarterStr.slice(0, 4));
const quarter = parseInt(quarterStr.slice(-1));
return (0, import_dayjs.dayjs)().quarter(quarter).year(year);
}, "convertQuarterToFirstDay");
const toMoment = /* @__PURE__ */ __name((val, options) => {

@@ -97,12 +103,16 @@ if (!val) {

const { gmt, picker, utc = true } = options;
if (!utc) {
return (0, import_dayjs.dayjs)(val);
if ((0, import_dayjs.dayjs)(val).isValid()) {
if (!utc) {
return (0, import_dayjs.dayjs)(val);
}
if (import_dayjs.dayjs.isDayjs(val)) {
return val.utcOffset(offsetFromString(offset));
}
if (gmt) {
return (0, import_dayjs.dayjs)(val).utcOffset(0);
}
return (0, import_dayjs.dayjs)(val).utcOffset(offsetFromString(offset));
} else {
return convertQuarterToFirstDay(val);
}
if (import_dayjs.dayjs.isDayjs(val)) {
return val.utcOffset(offsetFromString(offset));
}
if (gmt || picker) {
return (0, import_dayjs.dayjs)(val).utcOffset(0);
}
return (0, import_dayjs.dayjs)(val).utcOffset(offsetFromString(offset));
}, "toMoment");

@@ -185,5 +195,20 @@ const str2moment = /* @__PURE__ */ __name((value, options = {}) => {

__name(absFloor, "absFloor");
const getPickerFormat = /* @__PURE__ */ __name((picker) => {
switch (picker) {
case "week":
return "YYYY[W]W";
case "month":
return "YYYY-MM";
case "quarter":
return "YYYY[Q]Q";
case "year":
return "YYYY";
default:
return "YYYY-MM-DD";
}
}, "getPickerFormat");
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
getDefaultFormat,
getPickerFormat,
moment2str,

@@ -190,0 +215,0 @@ offsetFromString,

@@ -194,2 +194,5 @@ /**

const field = getField == null ? void 0 : getField(path);
if ((field == null ? void 0 : field.constructor.name) === "DateOnlyField" || (field == null ? void 0 : field.constructor.name) === "DatetimeNoTzField") {
return value;
}
return dateValueWrapper(value, (field == null ? void 0 : field.timezone) || timezone);

@@ -196,0 +199,0 @@ }

{
"name": "@nocobase/utils",
"version": "1.3.39-beta",
"version": "1.4.0-alpha",
"main": "lib/index.js",

@@ -17,3 +17,3 @@ "types": "./lib/index.d.ts",

},
"gitHead": "68daadf8575cddf9eeb09a1a672f9baf7aabe67a"
"gitHead": "f097a2bddec152522b5645bd5d451f4c866d2060"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc