umaki 0.4.2 → 0.5.0
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/README.md +36 -18
- package/dist/_virtual/_commonjsHelpers.cjs.js +1 -1
- package/dist/_virtual/_commonjsHelpers.es.js +1 -1
- package/dist/_virtual/isBetween.cjs.js +1 -1
- package/dist/_virtual/isBetween.es.js +1 -1
- package/dist/_virtual/timezone.cjs.js +15 -0
- package/dist/_virtual/timezone.es.js +15 -0
- package/dist/_virtual/utc.cjs.js +15 -0
- package/dist/_virtual/utc.es.js +15 -0
- package/dist/index.cjs.js +3 -1
- package/dist/index.es.js +3 -1
- package/dist/libs/control/bgScrollStop.cjs.js +1 -1
- package/dist/libs/control/bgScrollStop.es.js +1 -1
- package/dist/libs/control/pd.cjs.js +1 -1
- package/dist/libs/control/pd.es.js +1 -1
- package/dist/libs/control/scrollToHash.cjs.js +1 -1
- package/dist/libs/control/scrollToHash.es.js +1 -1
- package/dist/libs/control/videoPlayControl.cjs.js +1 -1
- package/dist/libs/control/videoPlayControl.es.js +1 -1
- package/dist/libs/convert/changeDateStringToSpecificFormat.cjs.js +9 -3
- package/dist/libs/convert/changeDateStringToSpecificFormat.d.ts +3 -4
- package/dist/libs/convert/changeDateStringToSpecificFormat.es.js +9 -3
- package/dist/libs/convert/changeDateStringToSpecificFormat.test.d.ts +1 -0
- package/dist/libs/convert/jsonStringToJsonObject.cjs.js +1 -1
- package/dist/libs/convert/jsonStringToJsonObject.es.js +1 -1
- package/dist/libs/eventControl/debounce.cjs.js +1 -1
- package/dist/libs/eventControl/debounce.es.js +1 -1
- package/dist/libs/eventControl/throttle.cjs.js +1 -1
- package/dist/libs/eventControl/throttle.es.js +1 -1
- package/dist/libs/get/getAspectRatio.cjs.js +1 -1
- package/dist/libs/get/getAspectRatio.es.js +1 -1
- package/dist/libs/get/getClassNames.cjs.js +1 -1
- package/dist/libs/get/getClassNames.es.js +1 -1
- package/dist/libs/get/getDocumentHeight.cjs.js +1 -1
- package/dist/libs/get/getDocumentHeight.es.js +1 -1
- package/dist/libs/get/getEventPaths.cjs.js +1 -1
- package/dist/libs/get/getEventPaths.es.js +1 -1
- package/dist/libs/get/getGcd.cjs.js +1 -1
- package/dist/libs/get/getGcd.es.js +1 -1
- package/dist/libs/get/getOrientation.cjs.js +1 -1
- package/dist/libs/get/getOrientation.es.js +1 -1
- package/dist/libs/get/getParentList.cjs.js +1 -1
- package/dist/libs/get/getParentList.es.js +1 -1
- package/dist/libs/get/getQueryParams.cjs.js +1 -1
- package/dist/libs/get/getQueryParams.es.js +1 -1
- package/dist/libs/get/getRem.cjs.js +1 -1
- package/dist/libs/get/getRem.es.js +1 -1
- package/dist/libs/get/getScrollbarWidth.cjs.js +1 -1
- package/dist/libs/get/getScrollbarWidth.es.js +1 -1
- package/dist/libs/get/getSessionStorage.cjs.js +1 -1
- package/dist/libs/get/getSessionStorage.es.js +1 -1
- package/dist/libs/get/getStringLength.cjs.js +1 -1
- package/dist/libs/get/getStringLength.es.js +1 -1
- package/dist/libs/get/getStylePropertyValue.cjs.js +1 -1
- package/dist/libs/get/getStylePropertyValue.es.js +1 -1
- package/dist/libs/get/getStylePropertyValueToNumber.cjs.js +1 -1
- package/dist/libs/get/getStylePropertyValueToNumber.es.js +1 -1
- package/dist/libs/get/getUaData.cjs.js +1 -1
- package/dist/libs/get/getUaData.es.js +1 -1
- package/dist/libs/is/index.d.ts +1 -0
- package/dist/libs/is/isAfterDateTime.cjs.js +18 -0
- package/dist/libs/is/isAfterDateTime.d.ts +10 -0
- package/dist/libs/is/isAfterDateTime.es.js +18 -0
- package/dist/libs/is/isAfterDateTime.test.d.ts +1 -0
- package/dist/libs/is/isBetweenDateTime.cjs.js +1 -1
- package/dist/libs/is/isBetweenDateTime.es.js +1 -1
- package/dist/libs/is/isExistAllElements.cjs.js +1 -1
- package/dist/libs/is/isExistAllElements.es.js +1 -1
- package/dist/libs/is/isIpad.cjs.js +1 -1
- package/dist/libs/is/isIpad.es.js +1 -1
- package/dist/libs/is/isKeyExists.cjs.js +1 -1
- package/dist/libs/is/isKeyExists.es.js +1 -1
- package/dist/libs/is/isSafari.cjs.js +1 -1
- package/dist/libs/is/isSafari.es.js +1 -1
- package/dist/libs/is/isScrollable.cjs.js +1 -1
- package/dist/libs/is/isScrollable.es.js +1 -1
- package/dist/libs/is/isTouchSupport.cjs.js +1 -1
- package/dist/libs/is/isTouchSupport.es.js +1 -1
- package/dist/libs/remove/removeAllHtmlTags.cjs.js +1 -1
- package/dist/libs/remove/removeAllHtmlTags.es.js +1 -1
- package/dist/libs/remove/removeAttribute.cjs.js +1 -1
- package/dist/libs/remove/removeAttribute.es.js +1 -1
- package/dist/libs/remove/removeSessionStorage.cjs.js +1 -1
- package/dist/libs/remove/removeSessionStorage.es.js +1 -1
- package/dist/libs/remove/removeStylePropertyValue.cjs.js +1 -1
- package/dist/libs/remove/removeStylePropertyValue.es.js +1 -1
- package/dist/libs/security/htmlSanitize.cjs.js +1 -1
- package/dist/libs/security/htmlSanitize.es.js +1 -1
- package/dist/libs/set/set100vh.cjs.js +1 -1
- package/dist/libs/set/set100vh.es.js +1 -1
- package/dist/libs/set/set100vw.cjs.js +1 -1
- package/dist/libs/set/set100vw.es.js +1 -1
- package/dist/libs/set/setAttribute.cjs.js +1 -1
- package/dist/libs/set/setAttribute.es.js +1 -1
- package/dist/libs/set/setScrollPositionToCenter.cjs.js +1 -1
- package/dist/libs/set/setScrollPositionToCenter.es.js +1 -1
- package/dist/libs/set/setSessionStorage.cjs.js +1 -1
- package/dist/libs/set/setSessionStorage.es.js +1 -1
- package/dist/libs/set/setStylePropertyValue.cjs.js +1 -1
- package/dist/libs/set/setStylePropertyValue.es.js +1 -1
- package/dist/libs/to/toBoolean.cjs.js +1 -1
- package/dist/libs/to/toBoolean.es.js +1 -1
- package/dist/libs/to/toPositiveNumber.cjs.js +1 -1
- package/dist/libs/to/toPositiveNumber.es.js +1 -1
- package/dist/libs/transform/wrapTextWithSpans.cjs.js +1 -1
- package/dist/libs/transform/wrapTextWithSpans.es.js +1 -1
- package/dist/libs/wait/sleep.cjs.js +1 -1
- package/dist/libs/wait/sleep.es.js +1 -1
- package/dist/libs/wait/waitForAllMediaLoaded.cjs.js +1 -1
- package/dist/libs/wait/waitForAllMediaLoaded.es.js +1 -1
- package/dist/node_modules/dayjs/plugin/isBetween.cjs.js +1 -1
- package/dist/node_modules/dayjs/plugin/isBetween.es.js +1 -1
- package/dist/node_modules/dayjs/plugin/timezone.cjs.js +78 -0
- package/dist/node_modules/dayjs/plugin/timezone.es.js +78 -0
- package/dist/node_modules/dayjs/plugin/utc.cjs.js +91 -0
- package/dist/node_modules/dayjs/plugin/utc.es.js +91 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -46,6 +46,7 @@ import { foo } from "umaki";
|
|
|
46
46
|
- [getStylePropertyValueToNumber](#getstylepropertyvaluetonumber)
|
|
47
47
|
- [getUaData](#getuadata)
|
|
48
48
|
- [Is](#is)
|
|
49
|
+
- [isAfterDateTime](#isafterdatetime)
|
|
49
50
|
- [isBetweenDateTime](#isbetweendatetime)
|
|
50
51
|
- [isExistAllElements](#isexistallelements)
|
|
51
52
|
- [isIpad](#isipad)
|
|
@@ -154,28 +155,25 @@ const date = "2023-10-05";
|
|
|
154
155
|
const formattedDate = changeDateStringToSpecificFormat(date, "MM/DD/YYYY");
|
|
155
156
|
console.log(formattedDate); // '10/05/2023'
|
|
156
157
|
|
|
157
|
-
// With
|
|
158
|
-
|
|
159
|
-
const
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
"
|
|
163
|
-
"ja"
|
|
158
|
+
// With timezone
|
|
159
|
+
const dateWithTz = "2025-04-25T00:00:00.000Z";
|
|
160
|
+
const formattedDateWithTz = changeDateStringToSpecificFormat(
|
|
161
|
+
dateWithTz,
|
|
162
|
+
"YYYY-MM-DD HH:mm:ss",
|
|
163
|
+
"Asia/Tokyo"
|
|
164
164
|
);
|
|
165
|
-
console.log(
|
|
166
|
-
|
|
167
|
-
// With different
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
"
|
|
172
|
-
"en"
|
|
165
|
+
console.log(formattedDateWithTz); // '2025-04-25 09:00:00'
|
|
166
|
+
|
|
167
|
+
// With different timezone
|
|
168
|
+
const formattedDateWithDifferentTz = changeDateStringToSpecificFormat(
|
|
169
|
+
dateWithTz,
|
|
170
|
+
"YYYY-MM-DD HH:mm:ss",
|
|
171
|
+
"America/New_York"
|
|
173
172
|
);
|
|
174
|
-
console.log(
|
|
173
|
+
console.log(formattedDateWithDifferentTz); // '2025-04-24 20:00:00'
|
|
175
174
|
```
|
|
176
175
|
|
|
177
|
-
Note:
|
|
178
|
-
Example: `import 'dayjs/locale/ja'`
|
|
176
|
+
Note: This function focuses on timezone handling rather than locale-specific formatting. When a timezone is specified, the date will be converted to that timezone before formatting.
|
|
179
177
|
|
|
180
178
|
[View file →](src/libs/convert/changeDateStringToSpecificFormat.ts)
|
|
181
179
|
|
|
@@ -453,6 +451,26 @@ console.log(uaData);
|
|
|
453
451
|
|
|
454
452
|
## Is
|
|
455
453
|
|
|
454
|
+
### isAfterDateTime
|
|
455
|
+
|
|
456
|
+
A function that checks if the current date is after a specified date.
|
|
457
|
+
|
|
458
|
+
```ts
|
|
459
|
+
import { isAfterDateTime } from "umaki";
|
|
460
|
+
|
|
461
|
+
const targetDate = "2023-10-01";
|
|
462
|
+
const result = isAfterDateTime(targetDate);
|
|
463
|
+
console.log(result); // true or false
|
|
464
|
+
|
|
465
|
+
// With custom current date
|
|
466
|
+
import dayjs from "dayjs";
|
|
467
|
+
|
|
468
|
+
const customCurrentDate = "2023-11-15";
|
|
469
|
+
const resultWithCustomDate = isAfterDateTime(targetDate, dayjs(customCurrentDate));
|
|
470
|
+
```
|
|
471
|
+
|
|
472
|
+
[View file →](src/libs/is/isAfterDateTime.ts)
|
|
473
|
+
|
|
456
474
|
### isBetweenDateTime
|
|
457
475
|
|
|
458
476
|
A function that checks if the current date is between two specified dates.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*!
|
|
3
|
+
* name: umaki
|
|
4
|
+
* version: v0.5.0
|
|
5
|
+
* description: A utility that is often used in web production.
|
|
6
|
+
* author: TsubasaHiga
|
|
7
|
+
* homepage: https://github.com/TsubasaHiga/umaki
|
|
8
|
+
* Released under the MIT License
|
|
9
|
+
*
|
|
10
|
+
* This software includes dependencies licensed under MIT, ISC, BSD-3-Clause, and Apache-2.0.
|
|
11
|
+
* For license information, please see LICENSE.txt
|
|
12
|
+
*/
|
|
13
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
14
|
+
var timezone = { exports: {} };
|
|
15
|
+
exports.__module = timezone;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* name: umaki
|
|
3
|
+
* version: v0.5.0
|
|
4
|
+
* description: A utility that is often used in web production.
|
|
5
|
+
* author: TsubasaHiga
|
|
6
|
+
* homepage: https://github.com/TsubasaHiga/umaki
|
|
7
|
+
* Released under the MIT License
|
|
8
|
+
*
|
|
9
|
+
* This software includes dependencies licensed under MIT, ISC, BSD-3-Clause, and Apache-2.0.
|
|
10
|
+
* For license information, please see LICENSE.txt
|
|
11
|
+
*/
|
|
12
|
+
var timezone = { exports: {} };
|
|
13
|
+
export {
|
|
14
|
+
timezone as __module
|
|
15
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*!
|
|
3
|
+
* name: umaki
|
|
4
|
+
* version: v0.5.0
|
|
5
|
+
* description: A utility that is often used in web production.
|
|
6
|
+
* author: TsubasaHiga
|
|
7
|
+
* homepage: https://github.com/TsubasaHiga/umaki
|
|
8
|
+
* Released under the MIT License
|
|
9
|
+
*
|
|
10
|
+
* This software includes dependencies licensed under MIT, ISC, BSD-3-Clause, and Apache-2.0.
|
|
11
|
+
* For license information, please see LICENSE.txt
|
|
12
|
+
*/
|
|
13
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
14
|
+
var utc = { exports: {} };
|
|
15
|
+
exports.__module = utc;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* name: umaki
|
|
3
|
+
* version: v0.5.0
|
|
4
|
+
* description: A utility that is often used in web production.
|
|
5
|
+
* author: TsubasaHiga
|
|
6
|
+
* homepage: https://github.com/TsubasaHiga/umaki
|
|
7
|
+
* Released under the MIT License
|
|
8
|
+
*
|
|
9
|
+
* This software includes dependencies licensed under MIT, ISC, BSD-3-Clause, and Apache-2.0.
|
|
10
|
+
* For license information, please see LICENSE.txt
|
|
11
|
+
*/
|
|
12
|
+
var utc = { exports: {} };
|
|
13
|
+
export {
|
|
14
|
+
utc as __module
|
|
15
|
+
};
|
package/dist/index.cjs.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*!
|
|
3
3
|
* name: umaki
|
|
4
|
-
* version: v0.
|
|
4
|
+
* version: v0.5.0
|
|
5
5
|
* description: A utility that is often used in web production.
|
|
6
6
|
* author: TsubasaHiga
|
|
7
7
|
* homepage: https://github.com/TsubasaHiga/umaki
|
|
@@ -34,6 +34,7 @@ const getStringLength = require("./libs/get/getStringLength.cjs.js");
|
|
|
34
34
|
const getStylePropertyValue = require("./libs/get/getStylePropertyValue.cjs.js");
|
|
35
35
|
const getStylePropertyValueToNumber = require("./libs/get/getStylePropertyValueToNumber.cjs.js");
|
|
36
36
|
const getUaData = require("./libs/get/getUaData.cjs.js");
|
|
37
|
+
const isAfterDateTime = require("./libs/is/isAfterDateTime.cjs.js");
|
|
37
38
|
const isBetweenDateTime = require("./libs/is/isBetweenDateTime.cjs.js");
|
|
38
39
|
const isExistAllElements = require("./libs/is/isExistAllElements.cjs.js");
|
|
39
40
|
const isIpad = require("./libs/is/isIpad.cjs.js");
|
|
@@ -80,6 +81,7 @@ exports.getStringLength = getStringLength.getStringLength;
|
|
|
80
81
|
exports.getStylePropertyValue = getStylePropertyValue.getStylePropertyValue;
|
|
81
82
|
exports.getStylePropertyValueToNumber = getStylePropertyValueToNumber.getStylePropertyValueToNumber;
|
|
82
83
|
exports.getUaData = getUaData.getUaData;
|
|
84
|
+
exports.isAfterDateTime = isAfterDateTime.isAfterDateTime;
|
|
83
85
|
exports.isBetweenDateTime = isBetweenDateTime.isBetweenDateTime;
|
|
84
86
|
exports.isExistAllElements = isExistAllElements.isExistAllElements;
|
|
85
87
|
exports.isIpad = isIpad.isIpad;
|
package/dist/index.es.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* name: umaki
|
|
3
|
-
* version: v0.
|
|
3
|
+
* version: v0.5.0
|
|
4
4
|
* description: A utility that is often used in web production.
|
|
5
5
|
* author: TsubasaHiga
|
|
6
6
|
* homepage: https://github.com/TsubasaHiga/umaki
|
|
@@ -32,6 +32,7 @@ import { getStringLength } from "./libs/get/getStringLength.es.js";
|
|
|
32
32
|
import { getStylePropertyValue } from "./libs/get/getStylePropertyValue.es.js";
|
|
33
33
|
import { getStylePropertyValueToNumber } from "./libs/get/getStylePropertyValueToNumber.es.js";
|
|
34
34
|
import { getUaData } from "./libs/get/getUaData.es.js";
|
|
35
|
+
import { isAfterDateTime } from "./libs/is/isAfterDateTime.es.js";
|
|
35
36
|
import { isBetweenDateTime } from "./libs/is/isBetweenDateTime.es.js";
|
|
36
37
|
import { isExistAllElements } from "./libs/is/isExistAllElements.es.js";
|
|
37
38
|
import { isIpad } from "./libs/is/isIpad.es.js";
|
|
@@ -75,6 +76,7 @@ export {
|
|
|
75
76
|
getStylePropertyValueToNumber,
|
|
76
77
|
getUaData,
|
|
77
78
|
htmlSanitize,
|
|
79
|
+
isAfterDateTime,
|
|
78
80
|
isBetweenDateTime,
|
|
79
81
|
isExistAllElements,
|
|
80
82
|
isIpad,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*!
|
|
3
3
|
* name: umaki
|
|
4
|
-
* version: v0.
|
|
4
|
+
* version: v0.5.0
|
|
5
5
|
* description: A utility that is often used in web production.
|
|
6
6
|
* author: TsubasaHiga
|
|
7
7
|
* homepage: https://github.com/TsubasaHiga/umaki
|
|
@@ -12,8 +12,14 @@
|
|
|
12
12
|
*/
|
|
13
13
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
14
14
|
const dayjs = require("dayjs");
|
|
15
|
-
const
|
|
16
|
-
|
|
15
|
+
const timezone = require("../../node_modules/dayjs/plugin/timezone.cjs.js");
|
|
16
|
+
const utc = require("../../node_modules/dayjs/plugin/utc.cjs.js");
|
|
17
|
+
const changeDateStringToSpecificFormat = (date, format = "YYYY年MM月DD日", tz) => {
|
|
18
|
+
if (tz) {
|
|
19
|
+
dayjs.extend(utc.default);
|
|
20
|
+
dayjs.extend(timezone.default);
|
|
21
|
+
return dayjs(date).tz(tz).format(format);
|
|
22
|
+
}
|
|
17
23
|
return dayjs(date).format(format);
|
|
18
24
|
};
|
|
19
25
|
exports.changeDateStringToSpecificFormat = changeDateStringToSpecificFormat;
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Converts a date string to a specific format using the dayjs library.
|
|
3
3
|
*
|
|
4
|
-
* Note:
|
|
5
|
-
* Example: import 'dayjs/locale/ja'
|
|
4
|
+
* Note: This function focuses on timezone handling rather than locale-specific formatting.
|
|
6
5
|
*
|
|
7
6
|
* @param date - The date string to be converted.
|
|
8
7
|
* @param format - The format to convert the date string to. Defaults to 'YYYY年MM月DD日'.
|
|
9
|
-
* @param
|
|
8
|
+
* @param tz - Optional timezone (e.g., 'Asia/Tokyo'). If provided, the date will be converted to this timezone.
|
|
10
9
|
* @returns The formatted date string.
|
|
11
10
|
*/
|
|
12
|
-
export declare const changeDateStringToSpecificFormat: (date: string, format?: string,
|
|
11
|
+
export declare const changeDateStringToSpecificFormat: (date: string, format?: string, tz?: string | null) => string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* name: umaki
|
|
3
|
-
* version: v0.
|
|
3
|
+
* version: v0.5.0
|
|
4
4
|
* description: A utility that is often used in web production.
|
|
5
5
|
* author: TsubasaHiga
|
|
6
6
|
* homepage: https://github.com/TsubasaHiga/umaki
|
|
@@ -10,8 +10,14 @@
|
|
|
10
10
|
* For license information, please see LICENSE.txt
|
|
11
11
|
*/
|
|
12
12
|
import dayjs from "dayjs";
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
import timezone from "../../node_modules/dayjs/plugin/timezone.es.js";
|
|
14
|
+
import utc from "../../node_modules/dayjs/plugin/utc.es.js";
|
|
15
|
+
const changeDateStringToSpecificFormat = (date, format = "YYYY年MM月DD日", tz) => {
|
|
16
|
+
if (tz) {
|
|
17
|
+
dayjs.extend(utc);
|
|
18
|
+
dayjs.extend(timezone);
|
|
19
|
+
return dayjs(date).tz(tz).format(format);
|
|
20
|
+
}
|
|
15
21
|
return dayjs(date).format(format);
|
|
16
22
|
};
|
|
17
23
|
export {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|