@nocobase/utils 1.5.0-beta.1 → 1.6.0-alpha.2
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/lib/parse-date.js +9 -9
- package/package.json +2 -2
package/lib/parse-date.js
CHANGED
|
@@ -99,7 +99,7 @@ function parseWeek(value) {
|
|
|
99
99
|
}
|
|
100
100
|
__name(parseWeek, "parseWeek");
|
|
101
101
|
function parseMonth(value) {
|
|
102
|
-
if (/^\d\d\d\d
|
|
102
|
+
if (/^\d\d\d\d-\d\d$/.test(value)) {
|
|
103
103
|
return {
|
|
104
104
|
unit: "month",
|
|
105
105
|
start: `${value}-01 00:00:00`
|
|
@@ -108,7 +108,7 @@ function parseMonth(value) {
|
|
|
108
108
|
}
|
|
109
109
|
__name(parseMonth, "parseMonth");
|
|
110
110
|
function parseDay(value) {
|
|
111
|
-
if (/^\d\d\d\d
|
|
111
|
+
if (/^\d\d\d\d-\d\d-\d\d$/.test(value)) {
|
|
112
112
|
return {
|
|
113
113
|
unit: "day",
|
|
114
114
|
start: `${value} 00:00:00`
|
|
@@ -117,7 +117,7 @@ function parseDay(value) {
|
|
|
117
117
|
}
|
|
118
118
|
__name(parseDay, "parseDay");
|
|
119
119
|
function parseHour(value) {
|
|
120
|
-
if (/^\d\d\d\d
|
|
120
|
+
if (/^\d\d\d\d-\d\d-\d\d(T|\s)\d\d$/.test(value)) {
|
|
121
121
|
return {
|
|
122
122
|
unit: "hour",
|
|
123
123
|
start: `${value}:00:00`
|
|
@@ -126,7 +126,7 @@ function parseHour(value) {
|
|
|
126
126
|
}
|
|
127
127
|
__name(parseHour, "parseHour");
|
|
128
128
|
function parseMinute(value) {
|
|
129
|
-
if (/^\d\d\d\d
|
|
129
|
+
if (/^\d\d\d\d-\d\d-\d\d(T|\s)\d\d:\d\d$/.test(value)) {
|
|
130
130
|
return {
|
|
131
131
|
unit: "minute",
|
|
132
132
|
start: `${value}:00`
|
|
@@ -135,7 +135,7 @@ function parseMinute(value) {
|
|
|
135
135
|
}
|
|
136
136
|
__name(parseMinute, "parseMinute");
|
|
137
137
|
function parseSecond(value) {
|
|
138
|
-
if (/^\d\d\d\d
|
|
138
|
+
if (/^\d\d\d\d-\d\d-\d\d(T|\s)\d\d:\d\d:\d\d$/.test(value)) {
|
|
139
139
|
return {
|
|
140
140
|
unit: "second",
|
|
141
141
|
start: `${value}`
|
|
@@ -144,7 +144,7 @@ function parseSecond(value) {
|
|
|
144
144
|
}
|
|
145
145
|
__name(parseSecond, "parseSecond");
|
|
146
146
|
function parseMillisecond(value) {
|
|
147
|
-
if (/^\d\d\d\d
|
|
147
|
+
if (/^\d\d\d\d-\d\d-\d\d(T|\s)\d\d:\d\d:\d\d\.\d\d\d$/.test(value)) {
|
|
148
148
|
return {
|
|
149
149
|
unit: "millisecond",
|
|
150
150
|
start: `${value}`
|
|
@@ -192,7 +192,7 @@ function parseDate(value, options = {}) {
|
|
|
192
192
|
let timezone = options.timezone || "+00:00";
|
|
193
193
|
const input = value;
|
|
194
194
|
if (typeof value === "string") {
|
|
195
|
-
const match = /(.+)((
|
|
195
|
+
const match = /(.+)((\+|-)\d\d:\d\d)$/.exec(value);
|
|
196
196
|
if (match) {
|
|
197
197
|
value = match[1];
|
|
198
198
|
timezone = match[2];
|
|
@@ -242,13 +242,13 @@ function parseDateBetween(value, options = {}) {
|
|
|
242
242
|
if (typeof value !== "string") {
|
|
243
243
|
return;
|
|
244
244
|
}
|
|
245
|
-
const match = /(.+)((
|
|
245
|
+
const match = /(.+)((\+|-)\d\d:\d\d)$/.exec(value);
|
|
246
246
|
let timezone = options.timezone || "+00:00";
|
|
247
247
|
if (match) {
|
|
248
248
|
value = match[1];
|
|
249
249
|
timezone = match[2];
|
|
250
250
|
}
|
|
251
|
-
const m = /^(\(|\[)(.+)
|
|
251
|
+
const m = /^(\(|\[)(.+),(.+)(\)|\])$/.exec(value);
|
|
252
252
|
if (!m) {
|
|
253
253
|
return;
|
|
254
254
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/utils",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0-alpha.2",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"types": "./lib/index.d.ts",
|
|
6
6
|
"license": "AGPL-3.0",
|
|
@@ -16,5 +16,5 @@
|
|
|
16
16
|
"multer": "^1.4.5-lts.1",
|
|
17
17
|
"object-path": "^0.11.8"
|
|
18
18
|
},
|
|
19
|
-
"gitHead": "
|
|
19
|
+
"gitHead": "08bbc34c21727fc0ad0880f397a42bf7741091ee"
|
|
20
20
|
}
|