@whiteslove/parsing-lexicon 0.7.0 → 0.7.1

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/contact.js +5 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@whiteslove/parsing-lexicon",
3
- "version": "0.7.0",
3
+ "version": "0.7.1",
4
4
  "description": "Shared deterministic multilingual parsing lexicon for WhitesLove housing and hiring services",
5
5
  "repository": {
6
6
  "type": "git",
package/src/contact.js CHANGED
@@ -8,6 +8,7 @@ const PHONE_LIKE_RE = /\+?\d(?:[\t \u00a0().-]*\d){9,}/g;
8
8
  // only returned after libphonenumber validation.
9
9
  const PHONE_CANDIDATE_RE = /\+?\d(?:[\t \u00a0().-]*\d){6,}(?:[\t \u00a0]*(?:ext\.?|extension|x|доб\.?|дод\.?)\s*\d{1,6})?/giu;
10
10
  const PHONE_EXTENSION_RE = /[\t \u00a0]*(?:ext\.?|extension|x|доб\.?|дод\.?)\s*(\d{1,6})$/iu;
11
+ const DATE_LIKE_PHONE_RE = /^\d{1,2}[./-]\d{1,2}[./-](?:\d{2}|\d{4})(?:\s+\d{1,2})?$/u;
11
12
 
12
13
  const TELEGRAM_USERNAME_RE = /^[A-Za-z0-9_]{5,32}$/;
13
14
  const TELEGRAM_LINK_RE = /(?:https?:\/\/)?(?:t\.me|telegram\.me|telegram\.dog)\/([A-Za-z0-9_]{5,32})(?:\/[0-9]+)?(?:[/?#][^\s]*)?/giu;
@@ -97,6 +98,10 @@ export function parsePhoneNumbers(value, options = {}) {
97
98
 
98
99
  for (const match of text.matchAll(PHONE_CANDIDATE_RE)) {
99
100
  const raw = match[0].trim();
101
+ // Date stamps frequently contain enough digits to look phone-like before
102
+ // a following colon (for example "29.08.2026 10:15"). They are temporal
103
+ // evidence, never public contact details.
104
+ if (DATE_LIKE_PHONE_RE.test(raw)) continue;
100
105
  const { base, extension } = splitPhoneExtension(raw);
101
106
  const parsed = parsePhoneNumberFromString(base, countryHint);
102
107
  if (!parsed) continue;