react-country-kit-core 2.0.0 → 2.1.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.
@@ -212,6 +212,12 @@ export interface IUseMultiSelectReturn<T> {
212
212
  removeItem: (item: T) => void;
213
213
  clearAll: () => void;
214
214
  }
215
+ export interface IDateFormat {
216
+ countryCode: string;
217
+ format: string;
218
+ separator: string;
219
+ weekStart: number;
220
+ }
215
221
  export interface IUseCountryReturn {
216
222
  country: ICountry | null;
217
223
  divisions: IDivision[];
@@ -230,4 +236,5 @@ export interface IUseCountryReturn {
230
236
  postalCode: {
231
237
  label: string;
232
238
  };
239
+ dateFormat: IDateFormat | null;
233
240
  }
@@ -0,0 +1,27 @@
1
+ import { IDateFormat } from '../types';
2
+ /**
3
+ * Returns all country date format mappings.
4
+ */
5
+ export declare function getAllDateFormats(): IDateFormat[];
6
+ /**
7
+ * Finds the date format configurations for a country by its ISO2 code (case-insensitive).
8
+ */
9
+ export declare function getDateFormatByCountry(iso2: string): IDateFormat;
10
+ /**
11
+ * Formats a Date object using a specified pattern (e.g. 'YYYY-MM-DD', 'DD/MM/YYYY').
12
+ * Only supports standard YYYY, MM, DD placeholders.
13
+ */
14
+ export declare function formatDateWithPattern(date: Date, pattern: string): string;
15
+ /**
16
+ * Formats a Date object based on the country's default date format.
17
+ */
18
+ export declare function formatDateByCountry(date: Date, iso2: string): string;
19
+ /**
20
+ * Parses a date string matching a specific pattern (e.g. 'YYYY-MM-DD', 'DD/MM/YYYY') and returns a Date object.
21
+ * Returns null if the string is invalid or does not match the pattern.
22
+ */
23
+ export declare function parseDateWithPattern(dateString: string, pattern: string): Date | null;
24
+ /**
25
+ * Parses a date string based on the country's default date format.
26
+ */
27
+ export declare function parseDateByCountry(dateString: string, iso2: string): Date | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-country-kit-core",
3
- "version": "2.0.0",
3
+ "version": "2.1.0",
4
4
  "type": "module",
5
5
  "description": "Core datasets, utilities, and hooks for react-country-kit. Comprehensive data for countries, currencies, timezones, languages, and divisions.",
6
6
  "author": "Kishor Mainali",