fix: creation date
This commit is contained in:
parent
ca7a32d684
commit
f0700bd0db
@ -110,7 +110,7 @@ const AuthorProfilePage = () => {
|
||||
<div>
|
||||
<h1 style={{ margin: 0, fontSize: '2.5rem' }}>{author.username}</h1>
|
||||
<p style={{ color: 'var(--mp-text-3, #5a6070)', margin: '0.5rem 0 0' }}>
|
||||
Member since {new Date(author.created_at).toLocaleDateString(undefined, { year: 'numeric', month: 'long' })}
|
||||
Member since {author.created_at ? new Date(author.created_at).toLocaleDateString(undefined, { year: 'numeric', month: 'long' }) : 'N/A'}
|
||||
</p>
|
||||
<div style={{ marginTop: '1rem', display: 'flex', gap: '1rem' }}>
|
||||
<div className="stat-pill" style={{
|
||||
|
||||
@ -582,7 +582,7 @@ const PluginDetail = () => {
|
||||
</div>
|
||||
<div className="review-item-meta">
|
||||
<span className="review-item-author">{r.username}</span>
|
||||
<span className="review-item-date">Verified User</span>
|
||||
<span className="review-item-date">{formatDate(r.created_at)}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div className="review-item-stars">
|
||||
|
||||
@ -99,7 +99,7 @@ const AdminPanel = () => {
|
||||
<td data-label="Email">{u.email}</td>
|
||||
<td data-label="Role"><span className={`role-badge ${u.role}`}>{u.role}</span></td>
|
||||
<td data-label="Stripe">{u.stripe_ready ? '✅' : '❌'}</td>
|
||||
<td data-label="Created">{new Date(u.created_at).toLocaleDateString()}</td>
|
||||
<td data-label="Created">{u.created_at ? new Date(u.created_at).toLocaleDateString() : 'N/A'}</td>
|
||||
<td data-label="Actions">
|
||||
<button className="btn-delete" onClick={() => deleteUser(u.id)}>Delete</button>
|
||||
</td>
|
||||
|
||||
@ -19,8 +19,8 @@ const DashboardPlugins = () => {
|
||||
name: curr.name,
|
||||
downloads: 0,
|
||||
earnings: 0,
|
||||
createdAt: curr.createdAt,
|
||||
updatedAt: curr.updatedAt
|
||||
created_at: curr.created_at,
|
||||
updated_at: curr.updated_at
|
||||
};
|
||||
}
|
||||
acc[id].downloads += (curr.downloads || 0);
|
||||
@ -30,8 +30,12 @@ const DashboardPlugins = () => {
|
||||
}, [timeSeries]);
|
||||
|
||||
const formatDate = (dateStr: string) => {
|
||||
if (!dateStr) return 'N/A';
|
||||
if (!dateStr || typeof dateStr !== 'string') return 'N/A';
|
||||
const normalized = dateStr.toLowerCase().trim();
|
||||
if (normalized === 'none' || normalized === 'null' || normalized === 'undefined') return 'N/A';
|
||||
|
||||
const date = new Date(dateStr);
|
||||
if (isNaN(date.getTime())) return 'N/A';
|
||||
return date.toLocaleDateString(undefined, { year: 'numeric', month: 'short', day: 'numeric' });
|
||||
};
|
||||
|
||||
@ -71,8 +75,8 @@ const DashboardPlugins = () => {
|
||||
</td>
|
||||
<td data-label="Dates">
|
||||
<div style={{ fontSize: '0.8rem', color: 'var(--dash-text-muted)' }}>
|
||||
<div>Created: {formatDate(p.createdAt)}</div>
|
||||
<div>Updated: {formatDate(p.updatedAt)}</div>
|
||||
<div>Created: {formatDate(p.created_at)}</div>
|
||||
<div>Updated: {formatDate(p.updated_at)}</div>
|
||||
</div>
|
||||
</td>
|
||||
<td data-label="Actions" style={{ textAlign: 'right' }}>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user