@krainovsd/js-helpers 0.16.6 → 0.16.7
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/cjs/index.cjs +7 -42
- package/lib/cjs/index.cjs.map +1 -1
- package/lib/esm/api/api.js +0 -3
- package/lib/esm/api/api.js.map +1 -1
- package/lib/esm/api/before/oauth-before-handler.js +0 -3
- package/lib/esm/api/before/oauth-before-handler.js.map +1 -1
- package/lib/esm/api/oauth.js +0 -3
- package/lib/esm/api/oauth.js.map +1 -1
- package/lib/esm/index.js +0 -4
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/lib/browser/download-file.js +0 -3
- package/lib/esm/lib/browser/download-file.js.map +1 -1
- package/lib/esm/lib/date/is-today.js +8 -5
- package/lib/esm/lib/date/is-today.js.map +1 -1
- package/lib/esm/lib/utils/field-view-format.js +0 -3
- package/lib/esm/lib/utils/field-view-format.js.map +1 -1
- package/lib/index.d.ts +1 -9
- package/package.json +1 -1
- package/lib/esm/lib/date/get-tomorrow.js +0 -9
- package/lib/esm/lib/date/get-tomorrow.js.map +0 -1
- package/lib/esm/lib/date/get-yesterday.js +0 -9
- package/lib/esm/lib/date/get-yesterday.js.map +0 -1
- package/lib/esm/lib/date/is-tomorrow.js +0 -15
- package/lib/esm/lib/date/is-tomorrow.js.map +0 -1
- package/lib/esm/lib/date/is-yesterday.js +0 -15
- package/lib/esm/lib/date/is-yesterday.js.map +0 -1
package/lib/cjs/index.cjs
CHANGED
|
@@ -3,9 +3,6 @@
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
5
|
const dayjs = require('dayjs');
|
|
6
|
-
const todayPlugin = require('dayjs/plugin/isToday');
|
|
7
|
-
const tomorrowPlugin = require('dayjs/plugin/isTomorrow');
|
|
8
|
-
const yesterdayPlugin = require('dayjs/plugin/isYesterday');
|
|
9
6
|
|
|
10
7
|
class ResponseError extends Error {
|
|
11
8
|
status;
|
|
@@ -124,44 +121,16 @@ function getToday() {
|
|
|
124
121
|
return { startToday, endToday };
|
|
125
122
|
}
|
|
126
123
|
|
|
127
|
-
function getTomorrow() {
|
|
128
|
-
const tomorrow = new Date();
|
|
129
|
-
tomorrow.setHours(0, 0, 0, 0);
|
|
130
|
-
tomorrow.setDate(tomorrow.getDate() + 1);
|
|
131
|
-
return tomorrow;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
function getYesterday() {
|
|
135
|
-
const yesterday = new Date();
|
|
136
|
-
yesterday.setHours(0, 0, 0, 0);
|
|
137
|
-
yesterday.setDate(yesterday.getDate() - 1);
|
|
138
|
-
return yesterday;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
dayjs.extend(todayPlugin);
|
|
142
124
|
function isToday(date) {
|
|
143
|
-
|
|
144
|
-
return dayjs(date).isToday();
|
|
145
|
-
}
|
|
146
|
-
catch {
|
|
125
|
+
if (date == undefined)
|
|
147
126
|
return false;
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
dayjs.extend(tomorrowPlugin);
|
|
152
|
-
function isTomorrow(date) {
|
|
153
|
-
try {
|
|
154
|
-
return dayjs(date).isTomorrow();
|
|
155
|
-
}
|
|
156
|
-
catch {
|
|
157
|
-
return false;
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
dayjs.extend(yesterdayPlugin);
|
|
162
|
-
function isYesterday(date) {
|
|
163
127
|
try {
|
|
164
|
-
|
|
128
|
+
const checkedDate = new Date(date);
|
|
129
|
+
const now = new Date();
|
|
130
|
+
return (((checkedDate.getFullYear() << 16) |
|
|
131
|
+
(checkedDate.getMonth() << 8) |
|
|
132
|
+
checkedDate.getDate()) ===
|
|
133
|
+
((now.getFullYear() << 16) | (now.getMonth() << 8) | now.getDate()));
|
|
165
134
|
}
|
|
166
135
|
catch {
|
|
167
136
|
return false;
|
|
@@ -2392,9 +2361,7 @@ exports.getOauthTokenFromOtherWindow = getOauthTokenFromOtherWindow;
|
|
|
2392
2361
|
exports.getQueryValues = getQueryValues;
|
|
2393
2362
|
exports.getRandomColor = getRandomColor;
|
|
2394
2363
|
exports.getToday = getToday;
|
|
2395
|
-
exports.getTomorrow = getTomorrow;
|
|
2396
2364
|
exports.getVisiblePosition = getVisiblePosition;
|
|
2397
|
-
exports.getYesterday = getYesterday;
|
|
2398
2365
|
exports.isArray = isArray;
|
|
2399
2366
|
exports.isBoolean = isBoolean;
|
|
2400
2367
|
exports.isDate = isDate;
|
|
@@ -2407,9 +2374,7 @@ exports.isObject = isObject;
|
|
|
2407
2374
|
exports.isPrimitive = isPrimitive;
|
|
2408
2375
|
exports.isString = isString;
|
|
2409
2376
|
exports.isToday = isToday;
|
|
2410
|
-
exports.isTomorrow = isTomorrow;
|
|
2411
2377
|
exports.isUndefined = isUndefined;
|
|
2412
|
-
exports.isYesterday = isYesterday;
|
|
2413
2378
|
exports.joinPaths = joinPaths;
|
|
2414
2379
|
exports.jsonParse = jsonParse;
|
|
2415
2380
|
exports.limitStreamOfRequests = limitStreamOfRequests;
|