From 43b358e28c9cf5412621d5b92deae97253993419 Mon Sep 17 00:00:00 2001 From: tiennm99 Date: Fri, 3 Apr 2026 23:17:26 +0700 Subject: [PATCH] feat: add date range presets (Today, Last 7d, Last 30d, This month) --- src/app/components/ExchangeRateViewer.js | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/app/components/ExchangeRateViewer.js b/src/app/components/ExchangeRateViewer.js index ccc14d3..5876bc2 100644 --- a/src/app/components/ExchangeRateViewer.js +++ b/src/app/components/ExchangeRateViewer.js @@ -3,7 +3,7 @@ import React, { useState } from "react"; import DatePicker from "react-datepicker"; import "react-datepicker/dist/react-datepicker.css"; -import { format, subDays } from "date-fns"; +import { format, subDays, startOfMonth } from "date-fns"; function LoadingSpinner({ progress }) { return ( @@ -256,6 +256,26 @@ export default function ExchangeRateViewer() { + {/* Date presets */} +
+ {[ + { label: "Today", start: new Date(), end: new Date() }, + { label: "Last 7 days", start: subDays(new Date(), 7), end: new Date() }, + { label: "Last 30 days", start: subDays(new Date(), 30), end: new Date() }, + { label: "This month", start: startOfMonth(new Date()), end: new Date() }, + ].map((preset) => ( + + ))} +
+ {/* Buttons row */}