umaki 0.4.2 → 0.4.3
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 +15 -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 +1 -1
- package/dist/index.es.js +1 -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/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
|
@@ -154,28 +154,25 @@ const date = "2023-10-05";
|
|
|
154
154
|
const formattedDate = changeDateStringToSpecificFormat(date, "MM/DD/YYYY");
|
|
155
155
|
console.log(formattedDate); // '10/05/2023'
|
|
156
156
|
|
|
157
|
-
// With
|
|
158
|
-
|
|
159
|
-
const
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
"
|
|
163
|
-
"ja"
|
|
157
|
+
// With timezone
|
|
158
|
+
const dateWithTz = "2025-04-25T00:00:00.000Z";
|
|
159
|
+
const formattedDateWithTz = changeDateStringToSpecificFormat(
|
|
160
|
+
dateWithTz,
|
|
161
|
+
"YYYY-MM-DD HH:mm:ss",
|
|
162
|
+
"Asia/Tokyo"
|
|
164
163
|
);
|
|
165
|
-
console.log(
|
|
166
|
-
|
|
167
|
-
// With different
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
"
|
|
172
|
-
"en"
|
|
164
|
+
console.log(formattedDateWithTz); // '2025-04-25 09:00:00'
|
|
165
|
+
|
|
166
|
+
// With different timezone
|
|
167
|
+
const formattedDateWithDifferentTz = changeDateStringToSpecificFormat(
|
|
168
|
+
dateWithTz,
|
|
169
|
+
"YYYY-MM-DD HH:mm:ss",
|
|
170
|
+
"America/New_York"
|
|
173
171
|
);
|
|
174
|
-
console.log(
|
|
172
|
+
console.log(formattedDateWithDifferentTz); // '2025-04-24 20:00:00'
|
|
175
173
|
```
|
|
176
174
|
|
|
177
|
-
Note:
|
|
178
|
-
Example: `import 'dayjs/locale/ja'`
|
|
175
|
+
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
176
|
|
|
180
177
|
[View file →](src/libs/convert/changeDateStringToSpecificFormat.ts)
|
|
181
178
|
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*!
|
|
3
|
+
* name: umaki
|
|
4
|
+
* version: v0.4.3
|
|
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.4.3
|
|
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.4.3
|
|
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.4.3
|
|
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
package/dist/index.es.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*!
|
|
3
3
|
* name: umaki
|
|
4
|
-
* version: v0.4.
|
|
4
|
+
* version: v0.4.3
|
|
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.4.
|
|
3
|
+
* version: v0.4.3
|
|
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 {};
|