@defra/wls-eps-web-service
Version:
The web service for wildlife licencing of European Protected Species
18 lines (14 loc) • 544 B
JavaScript
export const timestampFormatter = ts => ts
? Intl.DateTimeFormat('en-GB', { year: 'numeric', month: 'long', day: 'numeric' }).format(new Date(ts))
: null
export const timestampFormatterWithTime = ts => ts
? Intl.DateTimeFormat('en-GB', { year: 'numeric', month: 'long', day: 'numeric', hour: 'numeric', minute: 'numeric', hour12: true }).format(new Date(ts))
: null
export const yesNoFromBool = a => {
if (a === undefined) {
return '-'
} else {
return a ? 'yes' : 'no'
}
}
export const boolFromYesNo = a => a === 'yes'