vueless 0.0.573 → 0.0.574
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/package.json
CHANGED
|
@@ -157,7 +157,11 @@ function onPaste(event: ClipboardEvent) {
|
|
|
157
157
|
const relativeTokensAmount = Number(userFormat.match(/(?<!\\)r/g)?.length);
|
|
158
158
|
|
|
159
159
|
// Amount of tokens used in format string without decimeters.
|
|
160
|
-
const
|
|
160
|
+
const dateFormatTokensAmount = props.userDateFormat
|
|
161
|
+
.split("")
|
|
162
|
+
.filter((char) => Object.keys(TOKEN_REG_EXP).includes(char)).length;
|
|
163
|
+
|
|
164
|
+
const timeFormatTokensAmount = props.userDateTimeFormat
|
|
161
165
|
.split("")
|
|
162
166
|
.filter((char) => Object.keys(TOKEN_REG_EXP).includes(char)).length;
|
|
163
167
|
|
|
@@ -180,13 +184,18 @@ function onPaste(event: ClipboardEvent) {
|
|
|
180
184
|
pastedTokensAmount -= relativeTokensAmount;
|
|
181
185
|
}
|
|
182
186
|
|
|
183
|
-
if (
|
|
187
|
+
if (
|
|
188
|
+
pastedTokensAmount !== dateFormatTokensAmount &&
|
|
189
|
+
pastedTokensAmount !== timeFormatTokensAmount
|
|
190
|
+
) {
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
184
193
|
|
|
185
194
|
const parsedDate = parseDate(pasteContent, userFormat, locale.value);
|
|
186
195
|
|
|
187
196
|
if (parsedDate) {
|
|
188
197
|
localValue.value = (
|
|
189
|
-
props.dateFormat ? formatDate(parsedDate,
|
|
198
|
+
props.dateFormat ? formatDate(parsedDate, userFormat, locale.value) : parsedDate
|
|
190
199
|
) as TModelValue;
|
|
191
200
|
}
|
|
192
201
|
} catch (error) {
|