Skip to content

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

@riteshrana12-dev

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working💻 aspect: codeConcerns the software code in the repository🚦status: awaiting triageHas not been triaged & therefore, not ready for work🛠 goal: fixBug fix

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions