urdu-text-utils 0.3.1 → 0.4.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/index.d.cts CHANGED
@@ -24,17 +24,147 @@ declare function convertNumbers(input: string, to?: DigitStyle): string;
24
24
  * Returns `NaN` when the string is not a number.
25
25
  */
26
26
  declare function parseUrduNumber(input: string): number;
27
+ /** Cardinal words for 0-9. Index 0 is empty: `0` is spelled `صفر` separately. */
28
+ declare const URDU_ONES: readonly string[];
29
+ /** Words for 10-20 plus every multiple of ten through 100. */
30
+ declare const URDU_TEENS_AND_TENS: Readonly<Record<number, string>>;
31
+ /**
32
+ * The 21-99 values that are irregular: Urdu does not compose them as
33
+ * "twenty-one", each unit has its own word. Every non-multiple of ten from 21
34
+ * to 99 appears here exactly once.
35
+ *
36
+ * A few of these spellings have documented variants (`26` also appears as
37
+ * `چھببیس`; `92` as `بیانوے`). This table follows the standard textbook forms.
38
+ */
39
+ declare const URDU_TENS_UNITS: Readonly<Record<number, string>>;
40
+ /**
41
+ * The South Asian scale, largest first. `کھرب` is 10^11 and `ارب` is 10^9 —
42
+ * note they are not the western billion/trillion, and each step below `کروڑ`
43
+ * is two orders of magnitude, not three.
44
+ */
45
+ declare const URDU_SCALES: ReadonlyArray<readonly [number, string]>;
46
+ /**
47
+ * Ordinals 1-6 are irregular; every larger ordinal is the last word of the
48
+ * cardinal with `واں` (masculine) or `ویں` (feminine) attached.
49
+ */
50
+ declare const URDU_ORDINAL_IRREGULARS: Readonly<Record<number, {
51
+ masculine: string;
52
+ feminine: string;
53
+ }>>;
27
54
  /**
28
55
  * Spell a whole number in Urdu words, using the South Asian scale
29
- * (ہزار, لاکھ, کروڑ, ارب) rather than the western million/billion scale.
56
+ * (ہزار, لاکھ, کروڑ, ارب, کھرب) rather than the western million/billion scale.
30
57
  *
31
- * Coverage note: 21-99 that are not multiples of ten are written compositionally
32
- * (`اکیس` etc. are irregular in real Urdu, so this returns `بیس ایک`-style forms
33
- * only as a fallback). Marked experimental for that reason.
58
+ * Every cardinal from 0 to 99 is a real irregular word — 21 is `اکیس`, not a
59
+ * composed `بیس ایک` — and the scale words are exact up to 10^15, beyond which
60
+ * JavaScript's own floating-point representation loses precision.
34
61
  *
35
- * @experimental
62
+ * @experimental The irregular 21-99 word table is transcribed from standard
63
+ * textbook forms; a handful of those words have recognised variant spellings.
64
+ *
65
+ * @example
66
+ * numberToUrduWords(1234567) // "بارہ لاکھ چونتیس ہزار پانچ سو سڑسٹھ"
67
+ * numberToUrduWords(1e9) // "ایک ارب"
36
68
  */
37
69
  declare function numberToUrduWords(value: number): string;
70
+ interface FormatUrduNumberOptions {
71
+ /**
72
+ * Digit block to emit. The separators follow it: Urdu digits pair with ٬/٫,
73
+ * English digits with `,`/`.`.
74
+ * @default "urdu"
75
+ */
76
+ digits?: "urdu" | "english";
77
+ /**
78
+ * `"southAsian"` groups as lakh/crore (12٬34٬567), `"western"` as thousands
79
+ * (1٬234٬567), `"none"` emits no separators.
80
+ * @default "southAsian"
81
+ */
82
+ grouping?: "southAsian" | "western" | "none";
83
+ /**
84
+ * Fraction digits, rounded half-up. Trailing zeros are dropped, so a whole
85
+ * number never grows a decimal separator.
86
+ *
87
+ * Rounding is applied to the binary double, not to its decimal spelling, and
88
+ * both language ports do the arithmetic identically. That keeps output
89
+ * byte-identical between them, and it means values whose decimal form is not
90
+ * exactly representable (2.675, 1.005) can round down rather than up. Asking
91
+ * for many digits exposes the representation itself: 1234567.891 at
92
+ * `decimals: 15` ends in the double's real binary noise. Keep this at 6 or
93
+ * below for display; `decimalPlaces`-style rounding of exact decimals is out
94
+ * of scope.
95
+ * @default 2
96
+ */
97
+ decimals?: number;
98
+ }
99
+ /**
100
+ * Format a number the way Urdu software prints numbers, with South Asian
101
+ * digit grouping and Urdu digits by default.
102
+ *
103
+ * Returns `""` for `NaN` and infinities, matching `formatUrduDate`.
104
+ *
105
+ * A very large magnitude prints the shortest decimal that represents the
106
+ * double, so beyond 2^53 the digits are the value the number really holds.
107
+ *
108
+ * @example
109
+ * formatUrduNumber(1234567) // "۱۲٬۳۴٬۵۶۷"
110
+ * formatUrduNumber(1234567, { grouping: "western" }) // "۱٬۲۳۴٬۵۶۷"
111
+ * formatUrduNumber(1234, { digits: "english" }) // "1,234"
112
+ * formatUrduNumber(-3.14159, { decimals: 3 }) // "-۳٫۱۴۲"
113
+ */
114
+ declare function formatUrduNumber(value: number, options?: FormatUrduNumberOptions): string;
115
+ interface FormatUrduCurrencyOptions extends FormatUrduNumberOptions {
116
+ /**
117
+ * `"digits"` prints the amount as a formatted number, `"words"` spells it out.
118
+ * @default "digits"
119
+ */
120
+ style?: "digits" | "words";
121
+ /** Unit used for every amount except exactly one. @default "روپے" */
122
+ unit?: string;
123
+ /** Unit used for an amount of exactly one. @default "روپیہ" */
124
+ singularUnit?: string;
125
+ }
126
+ /**
127
+ * Format a money amount with the right Urdu unit for the quantity.
128
+ *
129
+ * @experimental The `"words"` style inherits the note on
130
+ * {@link numberToUrduWords}, and like it requires a whole amount.
131
+ *
132
+ * @example
133
+ * formatUrduCurrency(1500) // "۱٬۵۰۰ روپے"
134
+ * formatUrduCurrency(1) // "۱ روپیہ"
135
+ * formatUrduCurrency(1500, { style: "words" }) // "ایک ہزار پانچ سو روپے"
136
+ * formatUrduCurrency(2.5, { unit: "ڈالر", singularUnit: "ڈالر" }) // "۲٫۵ ڈالر"
137
+ */
138
+ declare function formatUrduCurrency(value: number, options?: FormatUrduCurrencyOptions): string;
139
+ interface UrduOrdinalOptions {
140
+ /**
141
+ * Urdu ordinals inflect for gender: `پہلا` (masculine) vs `پہلی` (feminine).
142
+ * @default "masculine"
143
+ */
144
+ gender?: "masculine" | "feminine";
145
+ }
146
+ /**
147
+ * Spell an ordinal in Urdu — `پہلا`, `دوسرا`, `اکیسواں`, `سواں`.
148
+ *
149
+ * 1-6 are irregular and come from a table; everything else is the last word of
150
+ * the cardinal with the ordinal suffix, so `اکیس` becomes `اکیسواں` and `نوے`
151
+ * becomes `نوےواں`. A word-final `و` contracts instead of doubling, which is
152
+ * why `نو` becomes `نواں` (not `نوواں`) and `سو` becomes `سواں`.
153
+ *
154
+ * `0` returns `صفر`, since "zeroth" has no Urdu ordinal form. Returns `""` for
155
+ * non-finite input and throws for fractions, like {@link numberToUrduWords}.
156
+ *
157
+ * @experimental Inherits the note on {@link numberToUrduWords}.
158
+ *
159
+ * @example
160
+ * toUrduOrdinal(1) // "پہلا"
161
+ * toUrduOrdinal(1, { gender: "feminine" }) // "پہلی"
162
+ * toUrduOrdinal(9) // "نواں"
163
+ * toUrduOrdinal(21) // "اکیسواں"
164
+ * toUrduOrdinal(100) // "سواں"
165
+ * toUrduOrdinal(1100, { gender: "feminine" }) // "ایک ہزار ایک سویں"
166
+ */
167
+ declare function toUrduOrdinal(value: number, options?: UrduOrdinalOptions): string;
38
168
 
39
169
  interface NormalizeOptions {
40
170
  /** Apply Unicode NFKC first, folding presentation forms (ﻻ, ﮐ) back to real letters. Default `true`. */
@@ -399,6 +529,44 @@ declare function formatUrduDate(date: Date | string | number, pattern?: string,
399
529
  * timeAgoUrdu(Date.now() + 5 * 60 * 1000) // "۵ منٹ بعد"
400
530
  */
401
531
  declare function timeAgoUrdu(date: Date | string | number, relativeTo?: Date | string | number, options?: TimeAgoOptions): string;
532
+ interface ParseUrduDateOptions {
533
+ /**
534
+ * Year assumed when the input carries no year, e.g. `۲۲ اگست`.
535
+ * @default the current year
536
+ */
537
+ defaultYear?: number;
538
+ }
539
+ /**
540
+ * Parse a date written with Urdu or English month names, Urdu or ASCII digits,
541
+ * into a `Date`. This is the inverse of {@link formatUrduDate}, so anything
542
+ * that function can produce parses back to the same wall-clock moment:
543
+ *
544
+ * ```ts
545
+ * const d = new Date(2026, 7, 22, 14, 30);
546
+ * const text = formatUrduDate(d, "dddd، D MMMM YYYY، hh:mm A"); // "ہفتہ، ۲۲ اگست ۲۰۲۶، ۰۲:۳۰ دوپہر"
547
+ * parseUrduDate(text)?.getHours(); // 14
548
+ * ```
549
+ *
550
+ * Accepted input:
551
+ * - `۲۲ اگست ۲۰۲۶`, `22 August 2026`, `Aug 22, 2026` (Urdu or English month name)
552
+ * - `۲۲/۰۸/۲۰۲۶` — day-first, matching Pakistani convention
553
+ * - `2026-08-22` and `2026-08-22T14:30` — ISO, `` `T` `` form, no timezone offset
554
+ * - an optional preceding weekday name (ignored) and an optional time with
555
+ * `صبح دوپہر شام رات` or `am`/`pm`, e.g. `۰۲:۳۰ دوپہر`
556
+ *
557
+ * Deliberately rejected, returning `null`: absolute instants carrying a `Z` or
558
+ * numeric offset (this function never does timezone conversion — it builds the
559
+ * wall-clock time in the runtime's own zone, exactly as `formatUrduDate`
560
+ * reads it), Hijri month names, and dates that do not exist (`۳۱ فروری`).
561
+ * A two-digit year expands as `00-69` -> `20xx` and `70-99` -> `19xx`.
562
+ *
563
+ * @example
564
+ * parseUrduDate("۲۲ اگست ۲۰۲۶") // Date(2026, 7, 22)
565
+ * parseUrduDate("۵ جنوری ۲۰۲۶، ۰۹:۱۵ صبح")?.getHours() // 9
566
+ * parseUrduDate("5 جنوری") // Date(currentYear, 0, 5)
567
+ * parseUrduDate("۳۱ فروری ۲۰۲۶") // null
568
+ */
569
+ declare function parseUrduDate(input: string, options?: ParseUrduDateOptions): Date | null;
402
570
 
403
571
  /**
404
572
  * Canonical Urdu prefixes (سابقے) ordered by descending length.
@@ -543,4 +711,4 @@ declare function extractNameParts(fullName: string): {
543
711
  suffix?: string;
544
712
  };
545
713
 
546
- export { type AffixBreakdown, type DigitStyle, ENGLISH_NAME_ALIASES, type FormatUrduDateOptions, HONORIFICS, type IsUrduOptions, NAME_PREFIXES, type NameTransliterationOptions, type NormalizeOptions, PROTECTED_WORDS, SENTENCE_ABBREVIATIONS, type SearchOptions, type SearchResult, type SlugOptions, type SortOptions, type SplitSentenceOptions, type StemmerOptions, type TimeAgoOptions, URDU_FAMILY_NAMES, URDU_FIRST_NAMES, URDU_MONTHS_GREGORIAN, URDU_MONTHS_HIJRI, URDU_PREFIXES, URDU_STOP_WORDS, URDU_SUFFIXES, URDU_WEEKDAYS, type UrduStats, analyzeUrdu, compareUrdu, convertNumbers, countSentences, countWords, editDistance, extractNameParts, filterStopWords, foldUrdu, formatUrduDate, getAffixes, getUrduMonthName, getUrduWeekdayName, hasUrduSpecificLetters, highlightUrdu, isStopWord, isUrdu, normalizeUrdu, numberToUrduWords, parseUrduNumber, removeDiacritics, removeStopWords, romanToUrdu, romanize, searchUrdu, searchUrduRanked, sortUrdu, splitSentences, splitWords, stemUrdu, stemUrduText, timeAgoUrdu, toArabicIndicDigits, toEnglishDigits, toUrduDigits, transliterateNameToEnglish, transliterateNameToUrdu, urduRatio, urduSlug };
714
+ export { type AffixBreakdown, type DigitStyle, ENGLISH_NAME_ALIASES, type FormatUrduCurrencyOptions, type FormatUrduDateOptions, type FormatUrduNumberOptions, HONORIFICS, type IsUrduOptions, NAME_PREFIXES, type NameTransliterationOptions, type NormalizeOptions, PROTECTED_WORDS, type ParseUrduDateOptions, SENTENCE_ABBREVIATIONS, type SearchOptions, type SearchResult, type SlugOptions, type SortOptions, type SplitSentenceOptions, type StemmerOptions, type TimeAgoOptions, URDU_FAMILY_NAMES, URDU_FIRST_NAMES, URDU_MONTHS_GREGORIAN, URDU_MONTHS_HIJRI, URDU_ONES, URDU_ORDINAL_IRREGULARS, URDU_PREFIXES, URDU_SCALES, URDU_STOP_WORDS, URDU_SUFFIXES, URDU_TEENS_AND_TENS, URDU_TENS_UNITS, URDU_WEEKDAYS, type UrduOrdinalOptions, type UrduStats, analyzeUrdu, compareUrdu, convertNumbers, countSentences, countWords, editDistance, extractNameParts, filterStopWords, foldUrdu, formatUrduCurrency, formatUrduDate, formatUrduNumber, getAffixes, getUrduMonthName, getUrduWeekdayName, hasUrduSpecificLetters, highlightUrdu, isStopWord, isUrdu, normalizeUrdu, numberToUrduWords, parseUrduDate, parseUrduNumber, removeDiacritics, removeStopWords, romanToUrdu, romanize, searchUrdu, searchUrduRanked, sortUrdu, splitSentences, splitWords, stemUrdu, stemUrduText, timeAgoUrdu, toArabicIndicDigits, toEnglishDigits, toUrduDigits, toUrduOrdinal, transliterateNameToEnglish, transliterateNameToUrdu, urduRatio, urduSlug };
package/dist/index.d.ts CHANGED
@@ -24,17 +24,147 @@ declare function convertNumbers(input: string, to?: DigitStyle): string;
24
24
  * Returns `NaN` when the string is not a number.
25
25
  */
26
26
  declare function parseUrduNumber(input: string): number;
27
+ /** Cardinal words for 0-9. Index 0 is empty: `0` is spelled `صفر` separately. */
28
+ declare const URDU_ONES: readonly string[];
29
+ /** Words for 10-20 plus every multiple of ten through 100. */
30
+ declare const URDU_TEENS_AND_TENS: Readonly<Record<number, string>>;
31
+ /**
32
+ * The 21-99 values that are irregular: Urdu does not compose them as
33
+ * "twenty-one", each unit has its own word. Every non-multiple of ten from 21
34
+ * to 99 appears here exactly once.
35
+ *
36
+ * A few of these spellings have documented variants (`26` also appears as
37
+ * `چھببیس`; `92` as `بیانوے`). This table follows the standard textbook forms.
38
+ */
39
+ declare const URDU_TENS_UNITS: Readonly<Record<number, string>>;
40
+ /**
41
+ * The South Asian scale, largest first. `کھرب` is 10^11 and `ارب` is 10^9 —
42
+ * note they are not the western billion/trillion, and each step below `کروڑ`
43
+ * is two orders of magnitude, not three.
44
+ */
45
+ declare const URDU_SCALES: ReadonlyArray<readonly [number, string]>;
46
+ /**
47
+ * Ordinals 1-6 are irregular; every larger ordinal is the last word of the
48
+ * cardinal with `واں` (masculine) or `ویں` (feminine) attached.
49
+ */
50
+ declare const URDU_ORDINAL_IRREGULARS: Readonly<Record<number, {
51
+ masculine: string;
52
+ feminine: string;
53
+ }>>;
27
54
  /**
28
55
  * Spell a whole number in Urdu words, using the South Asian scale
29
- * (ہزار, لاکھ, کروڑ, ارب) rather than the western million/billion scale.
56
+ * (ہزار, لاکھ, کروڑ, ارب, کھرب) rather than the western million/billion scale.
30
57
  *
31
- * Coverage note: 21-99 that are not multiples of ten are written compositionally
32
- * (`اکیس` etc. are irregular in real Urdu, so this returns `بیس ایک`-style forms
33
- * only as a fallback). Marked experimental for that reason.
58
+ * Every cardinal from 0 to 99 is a real irregular word — 21 is `اکیس`, not a
59
+ * composed `بیس ایک` — and the scale words are exact up to 10^15, beyond which
60
+ * JavaScript's own floating-point representation loses precision.
34
61
  *
35
- * @experimental
62
+ * @experimental The irregular 21-99 word table is transcribed from standard
63
+ * textbook forms; a handful of those words have recognised variant spellings.
64
+ *
65
+ * @example
66
+ * numberToUrduWords(1234567) // "بارہ لاکھ چونتیس ہزار پانچ سو سڑسٹھ"
67
+ * numberToUrduWords(1e9) // "ایک ارب"
36
68
  */
37
69
  declare function numberToUrduWords(value: number): string;
70
+ interface FormatUrduNumberOptions {
71
+ /**
72
+ * Digit block to emit. The separators follow it: Urdu digits pair with ٬/٫,
73
+ * English digits with `,`/`.`.
74
+ * @default "urdu"
75
+ */
76
+ digits?: "urdu" | "english";
77
+ /**
78
+ * `"southAsian"` groups as lakh/crore (12٬34٬567), `"western"` as thousands
79
+ * (1٬234٬567), `"none"` emits no separators.
80
+ * @default "southAsian"
81
+ */
82
+ grouping?: "southAsian" | "western" | "none";
83
+ /**
84
+ * Fraction digits, rounded half-up. Trailing zeros are dropped, so a whole
85
+ * number never grows a decimal separator.
86
+ *
87
+ * Rounding is applied to the binary double, not to its decimal spelling, and
88
+ * both language ports do the arithmetic identically. That keeps output
89
+ * byte-identical between them, and it means values whose decimal form is not
90
+ * exactly representable (2.675, 1.005) can round down rather than up. Asking
91
+ * for many digits exposes the representation itself: 1234567.891 at
92
+ * `decimals: 15` ends in the double's real binary noise. Keep this at 6 or
93
+ * below for display; `decimalPlaces`-style rounding of exact decimals is out
94
+ * of scope.
95
+ * @default 2
96
+ */
97
+ decimals?: number;
98
+ }
99
+ /**
100
+ * Format a number the way Urdu software prints numbers, with South Asian
101
+ * digit grouping and Urdu digits by default.
102
+ *
103
+ * Returns `""` for `NaN` and infinities, matching `formatUrduDate`.
104
+ *
105
+ * A very large magnitude prints the shortest decimal that represents the
106
+ * double, so beyond 2^53 the digits are the value the number really holds.
107
+ *
108
+ * @example
109
+ * formatUrduNumber(1234567) // "۱۲٬۳۴٬۵۶۷"
110
+ * formatUrduNumber(1234567, { grouping: "western" }) // "۱٬۲۳۴٬۵۶۷"
111
+ * formatUrduNumber(1234, { digits: "english" }) // "1,234"
112
+ * formatUrduNumber(-3.14159, { decimals: 3 }) // "-۳٫۱۴۲"
113
+ */
114
+ declare function formatUrduNumber(value: number, options?: FormatUrduNumberOptions): string;
115
+ interface FormatUrduCurrencyOptions extends FormatUrduNumberOptions {
116
+ /**
117
+ * `"digits"` prints the amount as a formatted number, `"words"` spells it out.
118
+ * @default "digits"
119
+ */
120
+ style?: "digits" | "words";
121
+ /** Unit used for every amount except exactly one. @default "روپے" */
122
+ unit?: string;
123
+ /** Unit used for an amount of exactly one. @default "روپیہ" */
124
+ singularUnit?: string;
125
+ }
126
+ /**
127
+ * Format a money amount with the right Urdu unit for the quantity.
128
+ *
129
+ * @experimental The `"words"` style inherits the note on
130
+ * {@link numberToUrduWords}, and like it requires a whole amount.
131
+ *
132
+ * @example
133
+ * formatUrduCurrency(1500) // "۱٬۵۰۰ روپے"
134
+ * formatUrduCurrency(1) // "۱ روپیہ"
135
+ * formatUrduCurrency(1500, { style: "words" }) // "ایک ہزار پانچ سو روپے"
136
+ * formatUrduCurrency(2.5, { unit: "ڈالر", singularUnit: "ڈالر" }) // "۲٫۵ ڈالر"
137
+ */
138
+ declare function formatUrduCurrency(value: number, options?: FormatUrduCurrencyOptions): string;
139
+ interface UrduOrdinalOptions {
140
+ /**
141
+ * Urdu ordinals inflect for gender: `پہلا` (masculine) vs `پہلی` (feminine).
142
+ * @default "masculine"
143
+ */
144
+ gender?: "masculine" | "feminine";
145
+ }
146
+ /**
147
+ * Spell an ordinal in Urdu — `پہلا`, `دوسرا`, `اکیسواں`, `سواں`.
148
+ *
149
+ * 1-6 are irregular and come from a table; everything else is the last word of
150
+ * the cardinal with the ordinal suffix, so `اکیس` becomes `اکیسواں` and `نوے`
151
+ * becomes `نوےواں`. A word-final `و` contracts instead of doubling, which is
152
+ * why `نو` becomes `نواں` (not `نوواں`) and `سو` becomes `سواں`.
153
+ *
154
+ * `0` returns `صفر`, since "zeroth" has no Urdu ordinal form. Returns `""` for
155
+ * non-finite input and throws for fractions, like {@link numberToUrduWords}.
156
+ *
157
+ * @experimental Inherits the note on {@link numberToUrduWords}.
158
+ *
159
+ * @example
160
+ * toUrduOrdinal(1) // "پہلا"
161
+ * toUrduOrdinal(1, { gender: "feminine" }) // "پہلی"
162
+ * toUrduOrdinal(9) // "نواں"
163
+ * toUrduOrdinal(21) // "اکیسواں"
164
+ * toUrduOrdinal(100) // "سواں"
165
+ * toUrduOrdinal(1100, { gender: "feminine" }) // "ایک ہزار ایک سویں"
166
+ */
167
+ declare function toUrduOrdinal(value: number, options?: UrduOrdinalOptions): string;
38
168
 
39
169
  interface NormalizeOptions {
40
170
  /** Apply Unicode NFKC first, folding presentation forms (ﻻ, ﮐ) back to real letters. Default `true`. */
@@ -399,6 +529,44 @@ declare function formatUrduDate(date: Date | string | number, pattern?: string,
399
529
  * timeAgoUrdu(Date.now() + 5 * 60 * 1000) // "۵ منٹ بعد"
400
530
  */
401
531
  declare function timeAgoUrdu(date: Date | string | number, relativeTo?: Date | string | number, options?: TimeAgoOptions): string;
532
+ interface ParseUrduDateOptions {
533
+ /**
534
+ * Year assumed when the input carries no year, e.g. `۲۲ اگست`.
535
+ * @default the current year
536
+ */
537
+ defaultYear?: number;
538
+ }
539
+ /**
540
+ * Parse a date written with Urdu or English month names, Urdu or ASCII digits,
541
+ * into a `Date`. This is the inverse of {@link formatUrduDate}, so anything
542
+ * that function can produce parses back to the same wall-clock moment:
543
+ *
544
+ * ```ts
545
+ * const d = new Date(2026, 7, 22, 14, 30);
546
+ * const text = formatUrduDate(d, "dddd، D MMMM YYYY، hh:mm A"); // "ہفتہ، ۲۲ اگست ۲۰۲۶، ۰۲:۳۰ دوپہر"
547
+ * parseUrduDate(text)?.getHours(); // 14
548
+ * ```
549
+ *
550
+ * Accepted input:
551
+ * - `۲۲ اگست ۲۰۲۶`, `22 August 2026`, `Aug 22, 2026` (Urdu or English month name)
552
+ * - `۲۲/۰۸/۲۰۲۶` — day-first, matching Pakistani convention
553
+ * - `2026-08-22` and `2026-08-22T14:30` — ISO, `` `T` `` form, no timezone offset
554
+ * - an optional preceding weekday name (ignored) and an optional time with
555
+ * `صبح دوپہر شام رات` or `am`/`pm`, e.g. `۰۲:۳۰ دوپہر`
556
+ *
557
+ * Deliberately rejected, returning `null`: absolute instants carrying a `Z` or
558
+ * numeric offset (this function never does timezone conversion — it builds the
559
+ * wall-clock time in the runtime's own zone, exactly as `formatUrduDate`
560
+ * reads it), Hijri month names, and dates that do not exist (`۳۱ فروری`).
561
+ * A two-digit year expands as `00-69` -> `20xx` and `70-99` -> `19xx`.
562
+ *
563
+ * @example
564
+ * parseUrduDate("۲۲ اگست ۲۰۲۶") // Date(2026, 7, 22)
565
+ * parseUrduDate("۵ جنوری ۲۰۲۶، ۰۹:۱۵ صبح")?.getHours() // 9
566
+ * parseUrduDate("5 جنوری") // Date(currentYear, 0, 5)
567
+ * parseUrduDate("۳۱ فروری ۲۰۲۶") // null
568
+ */
569
+ declare function parseUrduDate(input: string, options?: ParseUrduDateOptions): Date | null;
402
570
 
403
571
  /**
404
572
  * Canonical Urdu prefixes (سابقے) ordered by descending length.
@@ -543,4 +711,4 @@ declare function extractNameParts(fullName: string): {
543
711
  suffix?: string;
544
712
  };
545
713
 
546
- export { type AffixBreakdown, type DigitStyle, ENGLISH_NAME_ALIASES, type FormatUrduDateOptions, HONORIFICS, type IsUrduOptions, NAME_PREFIXES, type NameTransliterationOptions, type NormalizeOptions, PROTECTED_WORDS, SENTENCE_ABBREVIATIONS, type SearchOptions, type SearchResult, type SlugOptions, type SortOptions, type SplitSentenceOptions, type StemmerOptions, type TimeAgoOptions, URDU_FAMILY_NAMES, URDU_FIRST_NAMES, URDU_MONTHS_GREGORIAN, URDU_MONTHS_HIJRI, URDU_PREFIXES, URDU_STOP_WORDS, URDU_SUFFIXES, URDU_WEEKDAYS, type UrduStats, analyzeUrdu, compareUrdu, convertNumbers, countSentences, countWords, editDistance, extractNameParts, filterStopWords, foldUrdu, formatUrduDate, getAffixes, getUrduMonthName, getUrduWeekdayName, hasUrduSpecificLetters, highlightUrdu, isStopWord, isUrdu, normalizeUrdu, numberToUrduWords, parseUrduNumber, removeDiacritics, removeStopWords, romanToUrdu, romanize, searchUrdu, searchUrduRanked, sortUrdu, splitSentences, splitWords, stemUrdu, stemUrduText, timeAgoUrdu, toArabicIndicDigits, toEnglishDigits, toUrduDigits, transliterateNameToEnglish, transliterateNameToUrdu, urduRatio, urduSlug };
714
+ export { type AffixBreakdown, type DigitStyle, ENGLISH_NAME_ALIASES, type FormatUrduCurrencyOptions, type FormatUrduDateOptions, type FormatUrduNumberOptions, HONORIFICS, type IsUrduOptions, NAME_PREFIXES, type NameTransliterationOptions, type NormalizeOptions, PROTECTED_WORDS, type ParseUrduDateOptions, SENTENCE_ABBREVIATIONS, type SearchOptions, type SearchResult, type SlugOptions, type SortOptions, type SplitSentenceOptions, type StemmerOptions, type TimeAgoOptions, URDU_FAMILY_NAMES, URDU_FIRST_NAMES, URDU_MONTHS_GREGORIAN, URDU_MONTHS_HIJRI, URDU_ONES, URDU_ORDINAL_IRREGULARS, URDU_PREFIXES, URDU_SCALES, URDU_STOP_WORDS, URDU_SUFFIXES, URDU_TEENS_AND_TENS, URDU_TENS_UNITS, URDU_WEEKDAYS, type UrduOrdinalOptions, type UrduStats, analyzeUrdu, compareUrdu, convertNumbers, countSentences, countWords, editDistance, extractNameParts, filterStopWords, foldUrdu, formatUrduCurrency, formatUrduDate, formatUrduNumber, getAffixes, getUrduMonthName, getUrduWeekdayName, hasUrduSpecificLetters, highlightUrdu, isStopWord, isUrdu, normalizeUrdu, numberToUrduWords, parseUrduDate, parseUrduNumber, removeDiacritics, removeStopWords, romanToUrdu, romanize, searchUrdu, searchUrduRanked, sortUrdu, splitSentences, splitWords, stemUrdu, stemUrduText, timeAgoUrdu, toArabicIndicDigits, toEnglishDigits, toUrduDigits, toUrduOrdinal, transliterateNameToEnglish, transliterateNameToUrdu, urduRatio, urduSlug };