Skip to content

Commit

Permalink
feat: Format dates to ArriveByTimeChart
Browse files Browse the repository at this point in the history
- set default settings for moment.js in App.tsx (tz and locale)
- display day + date on by-day
- display day + hour on by-hour
  • Loading branch information
Haswell-s committed Jan 14, 2024
1 parent ee93af2 commit b816c5f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
5 changes: 5 additions & 0 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ import router from './routes'
import { RouterProvider } from 'react-router-dom'
import { Suspense } from 'react'
import Preloader from './shared/Preloader'
import moment from 'moment-timezone'
import "moment/dist/locale/he"

Check failure on line 9 in src/App.tsx

View workflow job for this annotation

GitHub Actions / lint

Replace `"moment/dist/locale/he"` with `'moment/dist/locale/he'`

moment.tz.setDefault('Asia/Jerusalem');

Check failure on line 11 in src/App.tsx

View workflow job for this annotation

GitHub Actions / lint

Delete `;`
moment.locale("he");

Check failure on line 12 in src/App.tsx

View workflow job for this annotation

GitHub Actions / lint

Replace `"he");` with `'he')`

export const RoutedApp = () => (
<Suspense fallback={<Preloader />}>
Expand Down
8 changes: 5 additions & 3 deletions src/pages/dashboard/ArrivalByTimeChart/ArrivalByTimeChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {

import './ArrivalByTimeChats.scss'
import { useMemo } from 'react'
import moment from 'moment-timezone'

export const arrayGroup = function <T>(array: T[], f: (item: T) => string) {
const groups: Record<string, T[]> = {}
Expand Down Expand Up @@ -70,10 +71,11 @@ export default function ArrivalByTimeChart({
<>
<ul>
<li>
<span className="label">תאריך: </span>
<span className="label">זמן: </span>
<span className="value">
{payload![0].payload.gtfs_route_date ||
payload![0].payload.gtfs_route_hour}
{payload![0].payload.gtfs_route_date
? moment.utc(payload![0].payload.gtfs_route_date).format('יום ddd, L')

Check failure on line 77 in src/pages/dashboard/ArrivalByTimeChart/ArrivalByTimeChart.tsx

View workflow job for this annotation

GitHub Actions / lint

Replace `.utc(payload![0].payload.gtfs_route_date)` with `⏎····································.utc(payload![0].payload.gtfs_route_date)⏎····································`
: moment(payload![0].payload.gtfs_route_hour).format('יום dddd, LT')}

Check failure on line 78 in src/pages/dashboard/ArrivalByTimeChart/ArrivalByTimeChart.tsx

View workflow job for this annotation

GitHub Actions / lint

Replace `'יום·dddd,·LT'` with `⏎····································'יום·dddd,·LT',⏎··································`
</span>
</li>
<li>
Expand Down

0 comments on commit b816c5f

Please sign in to comment.