Skip to content

[Feature Request]: Improve month calculations in relative time formatting #24060

Description

@adamalston

The problem

The relative format util treats every month as 4 weeks. That can make relative dates drift from calendar months. #24059 fixes the case where 364 days was reported as 13 months, but the calculation is still based on 28 day blocks.

const months = Math.floor(weeks / 4);

The solution

Use a month calculation that better reflects calendar time instead of dividing weeks by 4. An average month length or calendar aware calculation could work. Whichever approach is chosen, the expected behavior around month ends and leap years should be clear.

Examples

The current calculation treats 28 days as 1 month and 336 days as 12 months. Calendar months vary from 28 to 31 days, so those results may not match what users expect.

Design impact

No

Documentation impact

  • The website documentation (carbondesignsystem.com)
  • Figma kit documentation
  • Storybook(s) documentation
  • I'm not sure

Package

I'm not sure

Project name

DataPower

Business priority

None

Available extra resources

No response

Code of Conduct

Activity

  1. carbon-automation commented on Nov 15, 2026

    @carbon-automation
    Contributor

    Thank you for submitting a feature request. Your proposal is open and will soon be triaged by the Carbon team.

    If your proposal is accepted and the Carbon team has bandwidth they will take on the issue, or else request you or other volunteers from the community to work on this issue.

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

Metadata

Metadata

Assignees

No one assigned

    Fields

    Start date

    None yet

    End date

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions