@linktr.ee/messaging-react 3.30.0-rc-1785816116 → 3.30.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@linktr.ee/messaging-react",
3
- "version": "3.30.0-rc-1785816116",
3
+ "version": "3.30.0",
4
4
  "description": "React messaging components built on messaging-core for web applications",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",
@@ -50,7 +50,7 @@
50
50
  },
51
51
  "dependencies": {
52
52
  "@linktr.ee/component-library": "11.8.6",
53
- "@linktr.ee/messaging-core": "2.3.0-rc-1785816116",
53
+ "@linktr.ee/messaging-core": "^2.2.0",
54
54
  "@linktr.ee/messaging-taxonomy": "^0.5.0",
55
55
  "@phosphor-icons/react": "^2.1.10",
56
56
  "culori": "^4.0.2"
@@ -96,33 +96,37 @@ describe('formatRelativeTime', () => {
96
96
  })
97
97
 
98
98
  describe('7+ days ago, same year (month and day)', () => {
99
+ // Compare against the same locale-aware formatter rather than
100
+ // hard-coded digits, which would fail under non-Latin numbering
101
+ // systems (e.g. ar_EG renders "٨ يناير").
99
102
  it('should return month + day without year for messages 7 days ago', () => {
100
103
  mockDate('2024-01-15T12:00:00')
101
104
  const date = new Date('2024-01-08T12:00:00')
102
- const result = formatRelativeTime(date)
103
- expect(result).toMatch(/\p{L}/u) // spelled-out month
104
- expect(result).toMatch(/\b8\b/) // day
105
- expect(result).not.toMatch(/2024|24/) // no year
105
+ expect(formatRelativeTime(date)).toBe(
106
+ date.toLocaleDateString(undefined, { month: 'short', day: 'numeric' })
107
+ )
106
108
  })
107
109
 
108
110
  it('should return month + day without year for messages more than 4 weeks ago in the same year', () => {
109
111
  mockDate('2024-02-15T12:00:00')
110
112
  const date = new Date('2024-01-01T12:00:00')
111
- const result = formatRelativeTime(date)
112
- expect(result).toMatch(/\p{L}/u) // spelled-out month
113
- expect(result).toMatch(/\b1\b/) // day
114
- expect(result).not.toMatch(/2024|24/) // no year
113
+ expect(formatRelativeTime(date)).toBe(
114
+ date.toLocaleDateString(undefined, { month: 'short', day: 'numeric' })
115
+ )
115
116
  })
116
117
  })
117
118
 
118
119
  describe('Previous years (month, day and year)', () => {
119
- it('should include the full year for messages from a previous year', () => {
120
+ it('should include the year for messages from a previous year', () => {
120
121
  mockDate('2024-01-15T12:00:00')
121
122
  const date = new Date('2023-12-01T12:00:00')
122
- const result = formatRelativeTime(date)
123
- expect(result).toMatch(/\p{L}/u) // spelled-out month
124
- expect(result).toMatch(/\b1\b/) // day
125
- expect(result).toMatch(/2023/) // full year
123
+ expect(formatRelativeTime(date)).toBe(
124
+ date.toLocaleDateString(undefined, {
125
+ month: 'short',
126
+ day: 'numeric',
127
+ year: 'numeric',
128
+ })
129
+ )
126
130
  })
127
131
  })
128
132