feat: batch details
This commit is contained in:
@@ -11,3 +11,31 @@ export function createToast(options) {
|
||||
export function timeAgo(date) {
|
||||
return useTimeAgo(date).value
|
||||
}
|
||||
|
||||
export function formatTime(timeString) {
|
||||
if (!timeString) return ''
|
||||
const [hour, minute] = timeString.split(':').map(Number)
|
||||
|
||||
// Create a Date object with dummy values for day, month, and year
|
||||
const dummyDate = new Date(0, 0, 0, hour, minute)
|
||||
|
||||
// Use Intl.DateTimeFormat to format the time in 12-hour format
|
||||
const formattedTime = new Intl.DateTimeFormat('en-US', {
|
||||
hour: 'numeric',
|
||||
minute: 'numeric',
|
||||
hour12: true,
|
||||
}).format(dummyDate)
|
||||
|
||||
return formattedTime
|
||||
}
|
||||
|
||||
export function formatNumberIntoCurrency(number, currency) {
|
||||
if (number) {
|
||||
return number.toLocaleString('en-IN', {
|
||||
maximumFractionDigits: 0,
|
||||
style: 'currency',
|
||||
currency: currency,
|
||||
})
|
||||
}
|
||||
return ''
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user