Skip to content

Commit

Permalink
Merge pull request #317 from FdelMazo/main
Browse files Browse the repository at this point in the history
Show year so far when clicking on current year
  • Loading branch information
jasonlong authored Jul 25, 2024
2 parents ad7e0ab + a59fe03 commit b7b3a7c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/iso.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { toArray, groupBy, last } from 'lodash-es'

const dateFormat = new Intl.DateTimeFormat('en-US', { month: 'short', day: 'numeric', timeZone: 'UTC' })
const sameDay = (d1, d2) => d1.toDateString() === d2.toDateString()

let days
let weeks
Expand Down Expand Up @@ -204,7 +205,9 @@ const loadStats = () => {
firstDay = d.date
}

if (days.at(-1) === d) {
if (sameDay(d.date, new Date())) {
lastDay = d.date
} else if (!lastDay && days.at(-1) === d) {
lastDay = d.date
}

Expand Down

0 comments on commit b7b3a7c

Please sign in to comment.