@fy-/fws-vue 2.3.39 → 2.3.41

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.
@@ -109,9 +109,23 @@ function formatDatetime(dt: Date | string | number) {
109
109
 
110
110
  function formatTimeago(dt: Date | string | number) {
111
111
  const timestamp = parseDateInput(dt)
112
- const locale = getLocale().split('-')[0].toLocaleLowerCase()
112
+ // Extract language code and convert dash to underscore for timeago.js format
113
+ const fullLocale = getLocale()
113
114
 
114
- return formatDateTimeago(new Date(timestamp), locale)
115
+ // First try with underscore format (en-US -> en_US)
116
+ const localeWithUnderscore = fullLocale.replace('-', '_')
117
+
118
+ // Then try just the language part (en-US -> en)
119
+ const langOnly = fullLocale.split('-')[0].toLowerCase()
120
+
121
+ // Try the formats in order of preference
122
+ // This avoids try/catch which can trigger linting issues
123
+ const dateObj = new Date(timestamp)
124
+
125
+ // No try/catch needed - if locale doesn't exist, timeago falls back to en_US
126
+ return formatDateTimeago(dateObj, localeWithUnderscore)
127
+ || formatDateTimeago(dateObj, langOnly)
128
+ || formatDateTimeago(dateObj, 'en_US')
115
129
  }
116
130
 
117
131
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fy-/fws-vue",
3
- "version": "2.3.39",
3
+ "version": "2.3.41",
4
4
  "author": "Florian 'Fy' Gasquez <m@fy.to>",
5
5
  "license": "MIT",
6
6
  "homepage": "https://github.com/fy-to/FWJS#readme",