@formkit/tempo 1.2.0 → 1.3.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/dist/bundle.mjs CHANGED
@@ -383,8 +383,9 @@ function isNumeric(part) {
383
383
  }
384
384
  function validate(parts2) {
385
385
  let lastPart = void 0;
386
- for (const part of parts2) {
387
- if (part.partName === "literal" && !isNaN(parseFloat(part.partValue))) {
386
+ const knownWidth = (p) => !p || p.partName === "literal" || p.token in fixedLength;
387
+ for (const [i, part] of parts2.entries()) {
388
+ if (part.partName === "literal" && !isNaN(parseFloat(part.partValue)) && !(knownWidth(parts2[i - 1]) && knownWidth(parts2[i + 1]))) {
388
389
  throw new Error(`Numbers in format (${part.partValue}).`);
389
390
  }
390
391
  if (lastPart && lastPart.partName !== "literal" && part.partName !== "literal") {