Skip to content

Commit

Permalink
fix: change schedule tables date format
Browse files Browse the repository at this point in the history
  • Loading branch information
mh-zeynal committed Nov 29, 2023
1 parent ee76438 commit af49600
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
4 changes: 2 additions & 2 deletions frontend/src/components/item-card/item-card.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,10 @@ const ItemCard = ({
{Helper.omitLongString(description, 50)}
</Typography>
<Typography variant="body1" sx={{ fontSize: 14 }} color="text.secondary">
From: {new Date(startDate).toLocaleString('fa-IR-u-nu-latn')}
From: {new Date(startDate).toLocaleString('fa-IR-u-nu-latn').replace(/:\d{2}$/, '')}
</Typography>
<Typography variant="body1" sx={{ fontSize: 14 }} color="text.secondary">
To: {new Date(endDate).toLocaleString('fa-IR-u-nu-latn')}
To: {new Date(endDate).toLocaleString('fa-IR-u-nu-latn').replace(/:\d{2}$/, '')}
</Typography>
<Divider sx={{ my: 1 }} />
<Presenter presenterName={presenterName} />
Expand Down
24 changes: 14 additions & 10 deletions frontend/src/pages/schedule/useSchedulePage.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,15 @@ export default function useSchedulePage() {
useEffect(() => {
if (workshopsData == null) return
setTableWorkshopsData(workshopsData.map(item => {
const startDate = Helper.convertStringToDateWithoutTimezone(item["start_date"])
const endDate = Helper.convertStringToDateWithoutTimezone(item["end_date"])
const startDate = new Date(item["start_date"]).toLocaleString('fa-IR-u-nu-latn')
.replace(/:\d{2}$/, '')
const endDate = new Date(item["end_date"]).toLocaleString('fa-IR-u-nu-latn')
.replace(/:\d{2}$/, '')
return {
Title: item.name,
date: Helper.convertDateTimeToDate(startDate),
Starts: Helper.convertDateTimeToTime(startDate),
Ends: Helper.convertDateTimeToTime(endDate),
date: startDate.split(',')[0],
Starts: startDate.split(',')[1],
Ends: endDate.split(',')[1],
}
}))
}, [workshopsData])
Expand All @@ -37,13 +39,15 @@ export default function useSchedulePage() {
setTablePresentationsData(presentationsData.filter(element => {
return element.name != null
}).map(item => {
const startDate = Helper.convertStringToDateWithoutTimezone(item["start_date"])
const endDate = Helper.convertStringToDateWithoutTimezone(item["end_date"])
const startDate = new Date(item["start_date"]).toLocaleString('fa-IR-u-nu-latn')
.replace(/:\d{2}$/, '')
const endDate = new Date(item["end_date"]).toLocaleString('fa-IR-u-nu-latn')
.replace(/:\d{2}$/, '')
return {
Title: item.name,
date: Helper.convertDateTimeToDate(startDate),
Starts: Helper.convertDateTimeToTime(startDate),
Ends: Helper.convertDateTimeToTime(endDate),
date: startDate.split(',')[0],
Starts: startDate.split(',')[1],
Ends: endDate.split(',')[1],
}
}))
}, [presentationsData])
Expand Down

0 comments on commit af49600

Please sign in to comment.