Add splitRoutePath and getMonthName functions to utils/numbers.ts and texts.ts

This commit is contained in:
probdg
2024-02-12 11:01:41 +07:00
parent a1212ffa01
commit 1750dd33df
12 changed files with 259 additions and 85 deletions

View File

@ -0,0 +1,17 @@
const splitRoutePath = (routePath: string): string[] => {
const routeParts = routePath.split('/').filter((part) => part !== '')
const routeArray: string[] = []
let currentRoute = ''
for (const part of routeParts) {
currentRoute += `/${part}`
routeArray.push(currentRoute)
}
return routeArray
}
export {
splitRoutePath
}

View File

@ -11,7 +11,13 @@ const splitRoutePath = (routePath: string): string[] => {
return routeArray
}
const getMonthName = (monthNumber :number)=> {
const months = [
'Januari', 'Februari', 'Maret', 'April', 'Mei', 'Juni',
'Juli', 'Agustus', 'September', 'Oktober', 'November', 'Desember'
];
return months[monthNumber - 1] || '';
}
export {
splitRoutePath
splitRoutePath,getMonthName
}