Skip to content

Commit

Permalink
Merge branch 'master' into fancy_graph
Browse files Browse the repository at this point in the history
# Conflicts:
#	src/statistics/FancyGraphCard.tsx
#	src/statistics/components/DatasetPickerCard.tsx
#	src/statistics/fancy_graph_entry.tsx
#	tapir/statistics/views/fancy_graph/base_view.py
#	tapir/statistics/views/fancy_graph/number_of_abcd_members_view.py
#	tapir/statistics/views/fancy_graph/number_of_active_members_view.py
#	tapir/statistics/views/fancy_graph/number_of_co_purchasers_view.py
#	tapir/statistics/views/fancy_graph/number_of_created_resignations_view.py
#	tapir/statistics/views/fancy_graph/number_of_exempted_members_view.py
#	tapir/statistics/views/fancy_graph/number_of_flying_members_view.py
#	tapir/statistics/views/fancy_graph/number_of_frozen_members_view.py
#	tapir/statistics/views/fancy_graph/number_of_investing_members_view.py
#	tapir/statistics/views/fancy_graph/number_of_long_term_frozen_members_view.py
#	tapir/statistics/views/fancy_graph/number_of_members_view.py
#	tapir/statistics/views/fancy_graph/number_of_paused_members_view.py
#	tapir/statistics/views/fancy_graph/number_of_pending_resignations_view.py
#	tapir/statistics/views/fancy_graph/number_of_purchasing_members_view.py
#	tapir/statistics/views/fancy_graph/number_of_shift_partners_view.py
#	tapir/statistics/views/fancy_graph/number_of_working_members_view.py
  • Loading branch information
Theophile-Madet committed Dec 6, 2024
2 parents 7db4544 + afa7ba1 commit 6b60fdb
Showing 1 changed file with 65 additions and 0 deletions.
65 changes: 65 additions & 0 deletions src/statistics/components/DateRangePickerCard.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
import React from "react";
import { Card, FloatingLabel, Form } from "react-bootstrap";
import { getFirstOfMonth } from "../utils.tsx";

declare let gettext: (english_text: string) => string;

interface DateRangePickerCardProps {
dateFrom: Date;
setDateFrom: (date: Date) => void;
dateTo: Date;
setDateTo: (date: Date) => void;
}

const DateRangePickerCard: React.FC<DateRangePickerCardProps> = ({
dateFrom,
setDateFrom,
dateTo,
setDateTo,
}) => {
return (
<Card>
<Card.Header>
<h5>{gettext("Set date range")}</h5>
</Card.Header>
<Card.Body>
<Form>
<div className={"d-flex flex-row gap-2"}>
<Form.Group>
<FloatingLabel label={"Date from"}>
<Form.Control
type={"date"}
value={
!isNaN(dateFrom.getTime())
? dateFrom.toISOString().substring(0, 10)
: undefined
}
onChange={(event) => {
setDateFrom(getFirstOfMonth(new Date(event.target.value)));
}}
/>
</FloatingLabel>
</Form.Group>
<Form.Group>
<FloatingLabel label={"Date from"}>
<Form.Control
type={"date"}
value={
!isNaN(dateTo.getTime())
? dateTo.toISOString().substring(0, 10)
: undefined
}
onChange={(event) => {
setDateTo(getFirstOfMonth(new Date(event.target.value)));
}}
/>
</FloatingLabel>
</Form.Group>
</div>
</Form>
</Card.Body>
</Card>
);
};

export default DateRangePickerCard;

0 comments on commit 6b60fdb

Please sign in to comment.