Skip to content

馃悰 [Bug report]: formatDate uses Date() without new keyword, always returns current month聽#1704

Description

@riteshrana12-dev

Contributor Guidelines

  • I have read the guidelines and discussion

Descrcibe the bug?

In src/common/utils/commonUtils.js, the formatDate function calls Date(year, month, day)
without the new keyword. Without new, JavaScript's Date() ignores all arguments and
returns the current date as a string. This means every user's join month shows the current
month instead of their actual join month.

Steps to reproduce the bug?

  1. Call formatDate('2023-01-15T00:00:00')
  2. The returned string shows current month instead of "Jan"

Expected behavior

formatDate('2023-01-15T00:00:00') should return "Joined 15 Jan 2023"
but instead returns the current month name every time.

Desktop (Please provide your system information)

  • OS: Windows
  • Browser: Chrome
  • Version: Not applicable (this is a code bug, not a visual/browser issue)

Mobile (Please provide your device information)

No response

Screenshot / Screenshare

No response

Relevant log output

No response

Record

Code of Conduct

  • I agree to follow this project's Code of Conduct

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions