Skip to content

Commit

Permalink
removing language as parameter, edit old format fnc invoke
Browse files Browse the repository at this point in the history
  • Loading branch information
viiktorstefanov committed Oct 3, 2024
1 parent 6561a90 commit a3124e8
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/common/util/date.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { bg, enUS } from 'date-fns/locale'
export const formatDate = 'dd MMM yyyy'
export const formatDatetime = 'dd MMM yyyy HH:mm:ss'

export const formatDateString = (dateString: string | Date, language?: string) => {
export const formatDateString = (dateString: string | Date) => {
return format(new Date(dateString), 'dd.MM.yyyy')
}

Expand Down
2 changes: 1 addition & 1 deletion src/components/admin/modal/DetailsModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ function DetailsModal() {
<ListItem>
<ListItemText primary={row.row.person.email} secondary={row.row.person.phone} />
</ListItem>
<ListItem>{formatDateString(row.row.createdAt, i18n?.language)}</ListItem>
<ListItem>{formatDateString(row.row.createdAt)}</ListItem>
<ListItem>
<Typography variant="body2">{row.row.message || row.row.comment}</Typography>
</ListItem>
Expand Down
2 changes: 1 addition & 1 deletion src/components/client/auth/profile/PersonalInfoTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ export default function PersonalInfoTab() {
<p className={classes.bold}>{t('profile:personalInfo.birthday')}</p>
<Typography sx={{ color: person?.birthday ? undefined : '#F22727' }}>
{person?.birthday
? formatDateString(person?.birthday, i18n?.language)
? formatDateString(person?.birthday)
: t('profile:personalInfo.noBirthday')}
</Typography>
<Box className={classes.editBox}>
Expand Down
2 changes: 1 addition & 1 deletion src/components/client/blog/DateCreated.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default function DateCreated({ createdAt, showLabel = false }: Props) {
if (!createdAt) return null
return (
<Typography variant="subtitle2" color={grey[600]}>
{showLabel && t('blog:created-on')} {formatDateString(createdAt, i18n?.language)}
{showLabel && t('blog:created-on')} {formatDateString(createdAt)}
</Typography>
)
}
2 changes: 1 addition & 1 deletion src/components/client/campaign-news/CampaignNewsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ export default function CampaignNewsList({ articles }: Props) {
<Grid container item gap={1} xs="auto">
<AvTimerIcon color="primary" />
<Typography className={classes.articlepublishedDate}>
{formatDateString(article.publishedAt, i18n?.language)} &nbsp;
{formatDateString(article.publishedAt)} &nbsp;
{dateToTime(article.publishedAt, i18n?.language)}
</Typography>
</Grid>
Expand Down
2 changes: 1 addition & 1 deletion src/components/client/campaign-news/SingleArticlePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export default function SingleArticlePage({ slug }: Props) {
<Grid container item gap={1} xs="auto">
<AvTimerIcon color="primary" />
<Typography className={classes.articlepublishedDate}>
{formatDateString(article.publishedAt, i18n?.language)}
{formatDateString(article.publishedAt)}
</Typography>
</Grid>
<Grid container item gap={1} xs="auto" style={{ maxWidth: '100%' }} wrap="nowrap">
Expand Down
6 changes: 3 additions & 3 deletions src/components/client/campaign-news/secured/NewsAdminPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export function NewsAdminPage({ slug, isAdmin }: Props) {
flex: 1,
minWidth: 140,
renderCell: (params: GridRenderCellParams): React.ReactNode => {
return formatDateString(params.row.createdAt, i18n?.language)
return formatDateString(params.row.createdAt)
},
},
{
Expand All @@ -99,15 +99,15 @@ export function NewsAdminPage({ slug, isAdmin }: Props) {
minWidth: 200,
renderCell: (params: GridRenderCellParams): React.ReactNode => {
const date: Date = params.row.publishedAt
return date ? formatDateString(date, i18n?.language) : ''
return date ? formatDateString(date) : ''
},
},
{
field: 'editedAt',
headerName: t('article.lastEdit'),
headerClassName: classes.gridColumn,
renderCell: (params: GridRenderCellParams): React.ReactNode => {
return params.row.editedAt ? formatDateString(params.row.editedAt, i18n?.language) : ''
return params.row.editedAt ? formatDateString(params.row.editedAt) : ''
},
minWidth: 200,
flex: 1,
Expand Down
4 changes: 2 additions & 2 deletions src/components/client/campaigns/CampaignNewsSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ export default function CampaignNewsSection({ campaign, canCreateArticle }: Prop
<Grid container item wrap="nowrap" gap={1}>
<AvTimerIcon color="action" />
<Typography className={classes.articlePublishedDate}>
{`${formatDateString(article.publishedAt, i18n?.language)} ${dateToTime(
{`${formatDateString(article.publishedAt)} ${dateToTime(
article.publishedAt,
i18n?.language,
)}`}
Expand Down Expand Up @@ -228,7 +228,7 @@ export default function CampaignNewsSection({ campaign, canCreateArticle }: Prop
<Grid container item gap={1} xs="auto">
<AvTimerIcon color="action" />
<Typography className={classes.articlePublishedDate}>
{`${formatDateString(article.publishedAt, i18n?.language)} ${dateToTime(
{`${formatDateString(article.publishedAt)} ${dateToTime(
article.publishedAt,
i18n?.language,
)}`}
Expand Down
2 changes: 1 addition & 1 deletion src/components/common/person/PersonInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ function PersonInfo({ person }: Props) {
</Typography>
<Box className={classes.infoWrapper}>
<Typography>
{t('person:info.createdAt')}: {formatDateString(person.createdAt, i18n?.language)}
{t('person:info.createdAt')}: {formatDateString(person.createdAt)}
</Typography>
<Typography>
{t('person:info.company')}: {person.company.companyName}
Expand Down

0 comments on commit a3124e8

Please sign in to comment.