Allow heading tags (h1-h6) in ContentSanitizer so news editor headings render
This commit is contained in:
33
resources/js/utils/enhanceFormatting.js
Normal file
33
resources/js/utils/enhanceFormatting.js
Normal file
@@ -0,0 +1,33 @@
|
||||
const dateFormatter = new Intl.DateTimeFormat('en-US', {
|
||||
year: 'numeric',
|
||||
month: 'short',
|
||||
day: '2-digit',
|
||||
hour: '2-digit',
|
||||
minute: '2-digit',
|
||||
hour12: false,
|
||||
timeZone: 'UTC',
|
||||
})
|
||||
|
||||
const numberFormatter = new Intl.NumberFormat('en-US')
|
||||
|
||||
export function formatEnhanceDate(value) {
|
||||
if (!value) return '—'
|
||||
|
||||
const parsed = new Date(value)
|
||||
|
||||
if (Number.isNaN(parsed.getTime())) {
|
||||
return '—'
|
||||
}
|
||||
|
||||
return `${dateFormatter.format(parsed)} UTC`
|
||||
}
|
||||
|
||||
export function formatEnhanceInteger(value) {
|
||||
const parsed = Number(value)
|
||||
|
||||
if (!Number.isFinite(parsed)) {
|
||||
return '0'
|
||||
}
|
||||
|
||||
return numberFormatter.format(parsed)
|
||||
}
|
||||
Reference in New Issue
Block a user