fix: chart no longer shows tomorrow's date on 7/30-day views

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Usman Baig
2026-03-08 23:40:49 +01:00
parent 2f5bcf479a
commit 6f1956b740
4 changed files with 11 additions and 10 deletions

View File

@@ -12,6 +12,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
### Fixed
- **Charts no longer show tomorrow's date.** The visitor chart on 7-day and 30-day views could display the next day with zero traffic, making it look like a sudden drop. The chart now ends on today.
- **Login no longer gets stuck after updates.** If you happened to have Pulse open when a new version was deployed, logging back in could get stuck on a loading screen. The app now automatically refreshes itself to pick up the latest version.
- **City and region data is now accurate.** Location data was incorrectly showing the CDN server's location (e.g. Paris, Villeurbanne) instead of the visitor's actual city. Fixed by reading the correct visitor IP header from Bunny CDN.
- **"Reset Data" now clears everything.** Previously, resetting a site's data in Settings only removed pageviews and daily stats. Uptime check history, uptime daily stats, and cached dashboard data were left behind. All collected data is now properly cleared when you reset, while your site configuration, goals, funnels, and uptime monitors are kept.

View File

@@ -19,7 +19,7 @@ import {
type Stats,
type DailyStat,
} from '@/lib/api/stats'
import { getDateRange } from '@ciphera-net/ui'
import { getDateRange, formatDate } from '@ciphera-net/ui'
import { toast } from '@ciphera-net/ui'
import { Button } from '@ciphera-net/ui'
import { Select, DatePicker, DownloadIcon } from '@ciphera-net/ui'
@@ -71,7 +71,7 @@ function loadSavedSettings(): {
function getInitialDateRange(): { start: string; end: string } {
const settings = loadSavedSettings()
if (settings?.type === 'today') {
const today = new Date().toISOString().split('T')[0]
const today = formatDate(new Date())
return { start: today, end: today }
}
if (settings?.type === '7') return getDateRange(7)
@@ -377,7 +377,7 @@ export default function SiteDashboardPage() {
// Save intervals when they change
useEffect(() => {
let type = 'custom'
const today = new Date().toISOString().split('T')[0]
const today = formatDate(new Date())
if (dateRange.start === today && dateRange.end === today) type = 'today'
else if (dateRange.start === getDateRange(7).start) type = '7'
else if (dateRange.start === getDateRange(30).start) type = '30'
@@ -458,7 +458,7 @@ export default function SiteDashboardPage() {
variant="input"
className="min-w-[140px]"
value={
dateRange.start === new Date().toISOString().split('T')[0] && dateRange.end === new Date().toISOString().split('T')[0]
dateRange.start === formatDate(new Date()) && dateRange.end === formatDate(new Date())
? 'today'
: dateRange.start === getDateRange(7).start
? '7'
@@ -478,7 +478,7 @@ export default function SiteDashboardPage() {
saveSettings('30', range)
}
else if (value === 'today') {
const today = new Date().toISOString().split('T')[0]
const today = formatDate(new Date())
const range = { start: today, end: today }
setDateRange(range)
saveSettings('today', range)

8
package-lock.json generated
View File

@@ -8,7 +8,7 @@
"name": "pulse-frontend",
"version": "0.13.0-alpha",
"dependencies": {
"@ciphera-net/ui": "^0.0.92",
"@ciphera-net/ui": "^0.0.93",
"@ducanh2912/next-pwa": "^10.2.9",
"@radix-ui/react-icons": "^1.3.0",
"@simplewebauthn/browser": "^13.2.2",
@@ -1665,9 +1665,9 @@
}
},
"node_modules/@ciphera-net/ui": {
"version": "0.0.92",
"resolved": "https://npm.pkg.github.com/download/@ciphera-net/ui/0.0.92/68088da543459b34ab9fe780713537713b5e0673",
"integrity": "sha512-R+8fyvz7DhqHyJ2gai6ssRY3rE2OQlNt3ZepcpMeZouhujSNLO7KtApS4AP2qvJhKuWTnPNLj/B+kOWC3L4LMA==",
"version": "0.0.93",
"resolved": "https://npm.pkg.github.com/download/@ciphera-net/ui/0.0.93/f120357e54c0d9365579fd5aeb7fc5a5e18d52d6",
"integrity": "sha512-Fz+zx+qcIvN0CU6LPpj6o9KD9eDu9fg9wTiWU0eNK80qHEJcEqsiaJwY2NufLqTsBc0kDYmMG7iN0MzAI/m5/g==",
"dependencies": {
"@radix-ui/react-icons": "^1.3.0",
"clsx": "^2.1.0",

View File

@@ -12,7 +12,7 @@
"test:watch": "vitest"
},
"dependencies": {
"@ciphera-net/ui": "^0.0.92",
"@ciphera-net/ui": "^0.0.93",
"@ducanh2912/next-pwa": "^10.2.9",
"@radix-ui/react-icons": "^1.3.0",
"@simplewebauthn/browser": "^13.2.2",