Skip to content

Commit 1e8f71c

Browse files
chore: remove implicit date-fns dependency from demo page (#144)
1 parent 58c6da9 commit 1e8f71c

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

pages/01-cartesian-chart/axes-and-thresholds.page.tsx

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,20 @@
11
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
22
// SPDX-License-Identifier: Apache-2.0
33

4-
import { addDays, subYears } from "date-fns";
54
import { range } from "lodash";
65

6+
const addDays = (date: Date, days: number) => {
7+
const result = new Date(date);
8+
result.setDate(result.getDate() + days);
9+
return result;
10+
};
11+
12+
const subYears = (date: Date, years: number) => {
13+
const result = new Date(date);
14+
result.setFullYear(result.getFullYear() - years);
15+
return result;
16+
};
17+
718
import ColumnLayout from "@cloudscape-design/components/column-layout";
819

920
import { CartesianChart } from "../../lib/components";

0 commit comments

Comments
 (0)