Make dayjs date parse more reliable/robust

This commit is contained in:
Peter 2023-10-03 17:15:49 -05:00
parent ddb0e624cb
commit 65d68200ac
2 changed files with 3 additions and 4 deletions

View File

@ -144,7 +144,6 @@ export default {
methods: { methods: {
makeScheduleRowsFromGames(games: Game[]): ScheduleRow[] { makeScheduleRowsFromGames(games: Game[]): ScheduleRow[] {
const gamesByWeekAndHomeTeam = this.groupByWeekAndHomeTeam(games) const gamesByWeekAndHomeTeam = this.groupByWeekAndHomeTeam(games)
console.log(Object.values(gamesByWeekAndHomeTeam))
return Object.values(gamesByWeekAndHomeTeam).sort((games1, games2) => games1[0].id - games2[0].id).map(games => { return Object.values(gamesByWeekAndHomeTeam).sort((games1, games2) => games1[0].id - games2[0].id).map(games => {
return { return {
week: games[0].week, week: games[0].week,

View File

@ -126,9 +126,11 @@ import { type LeagueInfo, fetchCurrentLeagueInfo } from '@/services/currentServi
import { CURRENT_SEASON } from '@/services/utilities' import { CURRENT_SEASON } from '@/services/utilities'
import { fetchGamesBySeasonAndWeek } from '@/services/gameService' import { fetchGamesBySeasonAndWeek } from '@/services/gameService'
import dayjs from 'dayjs' import dayjs from 'dayjs'
import customParseFormat from 'dayjs/plugin/customParseFormat'
dayjs.extend(customParseFormat)
// TODO: Annually update this start date or get it from the DB // TODO: Annually update this start date or get it from the DB
const SEASON_START_DATE: dayjs.Dayjs = dayjs('07-31-2023') const SEASON_START_DATE: dayjs.Dayjs = dayjs('07-31-2023', 'MM/DD/YYYY')
export default { export default {
name: "ScheduleView", name: "ScheduleView",
@ -164,8 +166,6 @@ export default {
return storage return storage
}, {} as { [key: string]: Game[] }) }, {} as { [key: string]: Game[] })
console.log(groupedGames, Object.values(groupedGames))
return Object.values(groupedGames) return Object.values(groupedGames)
} }
}, },