@linktr.ee/messaging-react 3.14.4-rc-1784696010 → 3.14.4-rc-1784696529

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.14.4-rc-1784696010",
3
+ "version": "3.14.4-rc-1784696529",
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-1784696010",
53
+ "@linktr.ee/messaging-core": "2.3.0-rc-1784696529",
54
54
  "@phosphor-icons/react": "^2.1.10"
55
55
  },
56
56
  "devDependencies": {
@@ -95,16 +95,32 @@ describe('formatRelativeTime', () => {
95
95
  })
96
96
 
97
97
  describe('Date format', () => {
98
+ // The absolute-date branch intentionally uses the runtime locale
99
+ // (toLocaleDateString(undefined, …)), so assertions avoid a fixed
100
+ // string that would depend on the test runner's ambient ICU locale.
101
+ // Instead we assert the locale-independent behaviour: a spelled-out
102
+ // month (alphabetic) rather than the old all-numeric M/D/YY, plus the
103
+ // day and 2-digit year in any order.
104
+ const numericDatePattern = /^\d{1,2}\/\d{1,2}\/\d{2}$/
105
+
98
106
  it('should return a spelled-month date for messages more than 4 weeks ago', () => {
99
107
  mockDate('2024-02-15T12:00:00Z')
100
108
  const date = new Date('2024-01-01T12:00:00Z')
101
- expect(formatRelativeTime(date)).toBe('Jan 1, 24')
109
+ const result = formatRelativeTime(date)
110
+ expect(result).not.toMatch(numericDatePattern)
111
+ expect(result).toMatch(/\p{L}/u) // spelled-out month
112
+ expect(result).toMatch(/\b1\b/) // day
113
+ expect(result).toMatch(/24/) // 2-digit year
102
114
  })
103
115
 
104
116
  it('should return a spelled-month date for messages from last year', () => {
105
117
  mockDate('2024-01-15T12:00:00Z')
106
118
  const date = new Date('2023-12-01T12:00:00Z')
107
- expect(formatRelativeTime(date)).toBe('Dec 1, 23')
119
+ const result = formatRelativeTime(date)
120
+ expect(result).not.toMatch(numericDatePattern)
121
+ expect(result).toMatch(/\p{L}/u) // spelled-out month
122
+ expect(result).toMatch(/\b1\b/) // day
123
+ expect(result).toMatch(/23/) // 2-digit year
108
124
  })
109
125
  })
110
126