@cranberry-money/shared-utils 5.0.0 → 8.0.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/package.json +1 -1
- package/dist/date.d.ts +0 -64
- package/dist/text.d.ts +0 -22
package/package.json
CHANGED
package/dist/date.d.ts
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Date and time formatting utility functions
|
|
3
|
-
*
|
|
4
|
-
* This module provides pure functions for formatting dates and times
|
|
5
|
-
* in various formats suitable for display in the application.
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* Formats a date string to a localized date
|
|
9
|
-
*
|
|
10
|
-
* @param dateString - ISO date string or null
|
|
11
|
-
* @param fallback - Fallback text when date is null (default: 'No expiry')
|
|
12
|
-
* @returns Formatted date string
|
|
13
|
-
*
|
|
14
|
-
* @example
|
|
15
|
-
* ```typescript
|
|
16
|
-
* formatDate('2024-03-15') // '3/15/2024' (in en-US)
|
|
17
|
-
* formatDate(null) // 'No expiry'
|
|
18
|
-
* formatDate(null, 'Not set') // 'Not set'
|
|
19
|
-
* ```
|
|
20
|
-
*/
|
|
21
|
-
export declare function formatDate(dateString: string | null, fallback?: string): string;
|
|
22
|
-
/**
|
|
23
|
-
* Formats a date string to a short date format (e.g., "Jan 15")
|
|
24
|
-
*
|
|
25
|
-
* @param dateString - ISO date string
|
|
26
|
-
* @param locale - Locale for formatting (default: 'en-AU')
|
|
27
|
-
* @returns Formatted short date string
|
|
28
|
-
*
|
|
29
|
-
* @example
|
|
30
|
-
* ```typescript
|
|
31
|
-
* formatShortDate('2024-01-15') // 'Jan 15'
|
|
32
|
-
* formatShortDate('2024-12-25', 'en-US') // 'Dec 25'
|
|
33
|
-
* ```
|
|
34
|
-
*/
|
|
35
|
-
export declare function formatShortDate(dateString: string, locale?: string): string;
|
|
36
|
-
/**
|
|
37
|
-
* Formats a date string to a time format (24-hour)
|
|
38
|
-
*
|
|
39
|
-
* @param dateString - ISO date string
|
|
40
|
-
* @param locale - Locale for formatting (default: 'en-AU')
|
|
41
|
-
* @returns Formatted time string in 24-hour format
|
|
42
|
-
*
|
|
43
|
-
* @example
|
|
44
|
-
* ```typescript
|
|
45
|
-
* formatTime('2024-01-15T14:30:00') // '14:30'
|
|
46
|
-
* formatTime('2024-01-15T09:05:00') // '09:05'
|
|
47
|
-
* ```
|
|
48
|
-
*/
|
|
49
|
-
export declare function formatTime(dateString: string, locale?: string): string;
|
|
50
|
-
/**
|
|
51
|
-
* Formats a date string to a combined short date and time format
|
|
52
|
-
*
|
|
53
|
-
* @param dateString - ISO date string
|
|
54
|
-
* @param locale - Locale for formatting (default: 'en-AU')
|
|
55
|
-
* @returns Formatted string like "Jan 15 14:30"
|
|
56
|
-
*
|
|
57
|
-
* @example
|
|
58
|
-
* ```typescript
|
|
59
|
-
* formatDateTime('2024-01-15T14:30:00') // 'Jan 15 14:30'
|
|
60
|
-
* formatDateTime('2024-12-25T09:00:00', 'en-US') // 'Dec 25 09:00'
|
|
61
|
-
* ```
|
|
62
|
-
*/
|
|
63
|
-
export declare function formatDateTime(dateString: string, locale?: string): string;
|
|
64
|
-
//# sourceMappingURL=date.d.ts.map
|
package/dist/text.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Text manipulation utility functions
|
|
3
|
-
*
|
|
4
|
-
* This module provides pure functions for common text operations
|
|
5
|
-
* such as truncation, formatting, and manipulation.
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* Truncates text to a specified maximum length and adds ellipsis if needed
|
|
9
|
-
*
|
|
10
|
-
* @param text - The text to truncate
|
|
11
|
-
* @param maxLength - The maximum length of the text (default: 30)
|
|
12
|
-
* @returns The truncated text with ellipsis if it exceeds maxLength
|
|
13
|
-
*
|
|
14
|
-
* @example
|
|
15
|
-
* ```typescript
|
|
16
|
-
* truncateText('This is a very long text', 10) // 'This is a...'
|
|
17
|
-
* truncateText('Short', 10) // 'Short'
|
|
18
|
-
* truncateText('', 10) // ''
|
|
19
|
-
* ```
|
|
20
|
-
*/
|
|
21
|
-
export declare function truncateText(text: string, maxLength?: number): string;
|
|
22
|
-
//# sourceMappingURL=text.d.ts.map
|