rumahjo/app/library/joinDate.js

25 lines
610 B
JavaScript
Raw Normal View History

2024-09-07 00:46:58 +00:00
import { useEffect, useState } from "react";
const formatDate = (dateString) => {
const date = new Date(dateString);
const bulanIndo = (date) => {
const nama = [
'Jan', 'Feb', 'Mar', 'Apr',
'Mei', 'Jun', 'Jul', 'Agu',
'Sep', 'Okt', 'Nov', 'Des'
];
return nama[date.getMonth()];
}
const month = bulanIndo(date);
const year = date.getFullYear();
const option = { year: 'numeric', month: 'short', day: 'numeric' };
return `${month} ${year}`;
}
export function JoinDate(dateString) {
return formatDate(dateString);
}