const LOCALE = 'en-GB' ; /**
 * Format a date-ish object to a locale-friendly string
 */ export function formatDate ( date ? , defaultValue = '' , options = { } ) { if ( ! date ) { return defaultValue ; } return new Date ( date ) . toLocaleDateString ( LOCALE , { year : 'numeric' , month : 'long' , day : 'numeric' , ... options } ) ; } export function formatTime ( date ) { return new Date ( date ) . toLocaleTimeString ( LOCALE , { hour12 : false , hour : '2-digit' , minute : '2-digit' } ) ; } const numberFormat = Intl . NumberFormat ( LOCALE ) ; export function formatNumber ( value ) { return numberFormat . format ( value ) ; } export function formatSEOKeyValues ( dict ) { return Object . keys ( dict ) . flatMap ( ( key , index ) => [ { name : `twitter:label${ index + 1 }` , content : key } , { name : `twitter:data${ index + 1 }` , content : dict [ key ] } ] ) ; } export function formatStatNumber ( number , options = { } ) { return number . toLocaleString ( LOCALE , { notation : 'compact' , unitDisplay : 'short' , ... options } ) ; }