Skip to content

Commit

Permalink
Fix Parse for Date Range (actualbudget#3735)
Browse files Browse the repository at this point in the history
* fixed

* notes

* simplify
  • Loading branch information
carkom authored Oct 25, 2024
1 parent 5751d5d commit f25dc1f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/desktop-client/src/components/reports/DateRange.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import React, { type ReactElement } from 'react';

import * as d from 'date-fns';

import * as monthUtils from 'loot-core/src/shared/months';

import { theme } from '../../style';
import { styles } from '../../style/styles';
import { Block } from '../common/Block';
Expand All @@ -14,8 +16,8 @@ type DateRangeProps = {
};

function checkDate(date: string) {
const dateParsed = new Date(date);
if (dateParsed.toString() !== 'Invalid Date') {
const dateParsed = monthUtils.parseDate(date);
if (dateParsed) {
return d.format(dateParsed, 'yyyy-MM-dd');
} else {
return null;
Expand Down
6 changes: 6 additions & 0 deletions upcoming-release-notes/3735.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
category: Bugfix
authors: [carkom]
---

Fix parse date in DateRange element which is causing the cards to display the wrong dates.

0 comments on commit f25dc1f

Please sign in to comment.