Skip to content

feat(kno-15732): Skip quarters in feed timestamp formatting - #1077

Merged
cellomatt merged 4 commits into
mainfrom
cursor/limit-feed-timestamp-quarters-4d22
Oct 8, 2026
Merged

cellomatt merged 4 commits into
mainfrom
cursor/limit-feed-timestamp-quarters-4d22

Conversation

@cellomatt

@cellomatt cellomatt commented Oct 8, 2026 •

Copy link
Copy Markdown
Member

Description

This PR addresses the issue where the default NotificationCell displays feed item timestamps between ~3 months and 1 year old as "last quarter", "2 quarters ago", or "3 quarters ago", which reads oddly to end users.

What changed:

  1. Modified formatTimestamp in @knocklabs/react-core to pass unit: "month" to intlFormatDistance whenever the elapsed time falls in the range where date-fns would pick "quarter" (secondsInQuarter ≤ elapsed < secondsInYear, using date-fns's own constants). This makes timestamps read "6 months ago" instead of "2 quarters ago". Because the cutoff matches date-fns exactly, there's no boundary window where a quarter result can slip through (e.g. now = Oct 31 11:00, timestamp = Jul 31 12:00 is under 3 calendar months but past date-fns's ~91.3-day threshold).

  2. Added optional formatTimestamp prop to NotificationCell and NotificationFeed components, allowing customers to provide their own timestamp formatter without needing to rebuild the entire cell using renderItem.

  3. Exported new types (FormatTimestampOptions and TimestampFormatter) from both @knocklabs/react-core and @knocklabs/react for TypeScript consumers.

Why:

  • An enterprise customer reported that "2 quarters ago" reads oddly to their end users
  • The only workaround before this change was to hide .rnf-notification-cell__timestamp and render a custom timestamp via renderItem
  • date-fns also shows "4 quarters ago" for some past dates just under a year old (its differenceInCalendarQuarters(...) < 4 check doesn't use Math.abs); these now show months too

Example outputs:

Now Date Before After
Oct 8, 2026 Jul 1, 2026 "last quarter" "3 months ago"
Oct 8, 2026 May 1, 2026 "2 quarters ago" "5 months ago"
Oct 8, 2026 Jan 15, 2026 "3 quarters ago" "9 months ago"
Oct 8, 2026 Nov 15, 2025 "4 quarters ago" "11 months ago"
Oct 8, 2026 Oct 8, 2025 "4 quarters ago" "12 months ago"
Oct 8, 2026 Sep 20, 2025 "last year" "last year"
Oct 31, 2026 11:00 Jul 31, 2026 12:00 "last quarter" "3 months ago"

Checklist

  • Tests have been added for new features or major refactors to existing features.

Linear Issue: KNO-15732

Open in Web Open in Cursor 

- Modify formatTimestamp to use 'month' unit for dates 3-12 months old
  instead of letting date-fns choose 'quarter', which reads oddly
  (e.g. '2 quarters ago')
- Add optional formatTimestamp prop to NotificationCell and NotificationFeed
  to allow custom timestamp formatting without rebuilding the cell
- Export FormatTimestampOptions and TimestampFormatter types for consumers
- Add comprehensive tests for the new quarter-skipping behavior

Fixes KNO-15732

Co-authored-by: Matt Kufchak <cellomatt@users.noreply.github.com>
@changeset-bot

changeset-bot Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: f8a7ba0

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 10 packages
Name Type
@knocklabs/react-core Minor
@knocklabs/react Minor
@knocklabs/expo Patch
@knocklabs/react-native Patch
guide-example Patch
ms-teams-connect-example Patch
nextjs-app-dir-example Patch
nextjs-example Patch
slack-connect-example Patch
slack-kit-example Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel

vercel Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
javascript-ms-teams-connect-example Ready Ready Preview Oct 8, 2026 3:06pm UTC
javascript-nextjs-example Ready Ready Preview Oct 8, 2026 3:06pm UTC
javascript-slack-connect-example Ready Ready Preview Oct 8, 2026 3:06pm UTC
javascript-slack-kit-example Ready Ready Preview Oct 8, 2026 3:06pm UTC

Request Review

@linear-code

linear-code Bot commented Oct 8, 2026

Copy link
Copy Markdown

KNO-15732

cursoragent and others added 2 commits October 8, 2026 14:54
Co-authored-by: Matt Kufchak <cellomatt@users.noreply.github.com>
Co-authored-by: Matt Kufchak <cellomatt@users.noreply.github.com>
@codecov

codecov Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Bundle Report

Changes will increase total bundle size by 481 bytes (0.08%) ⬆️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
@knocklabs/react-core-react-core-cjs 33.53kB 152 bytes (0.46%) ⬆️
@knocklabs/react-react-esm 154.8kB 71 bytes (0.05%) ⬆️
@knocklabs/react-react-cjs 132.06kB 52 bytes (0.04%) ⬆️
@knocklabs/react-core-react-core-esm 39.67kB 206 bytes (0.52%) ⬆️

Affected Assets, Files, and Routes:

view changes for bundle: @knocklabs/react-core-react-core-esm

Assets Changed:

Asset Name Size Change Total Size Change (%)
modules/core/utils.mjs 206 bytes 1.45kB 16.56% ⚠️

Files in modules/core/utils.mjs:

  • ./src/modules/core/utils.ts → Total Size: 1.63kB
view changes for bundle: @knocklabs/react-react-esm

Assets Changed:

Asset Name Size Change Total Size Change (%)
modules/feed/components/NotificationFeed/NotificationFeed.mjs 47 bytes 3.12kB 1.53%
modules/feed/components/NotificationCell/NotificationCell.mjs 24 bytes 3.01kB 0.8%

Files in modules/feed/components/NotificationFeed/NotificationFeed.mjs:

  • ./src/modules/feed/components/NotificationFeed/NotificationFeed.tsx → Total Size: 3.03kB

Files in modules/feed/components/NotificationCell/NotificationCell.mjs:

  • ./src/modules/feed/components/NotificationCell/NotificationCell.tsx → Total Size: 3.31kB
view changes for bundle: @knocklabs/react-react-cjs

Assets Changed:

Asset Name Size Change Total Size Change (%)
modules/feed/components/NotificationFeed/NotificationFeed.js 36 bytes 2.52kB 1.45%
modules/feed/components/NotificationCell/NotificationCell.js 16 bytes 2.35kB 0.69%

Files in modules/feed/components/NotificationFeed/NotificationFeed.js:

  • ./src/modules/feed/components/NotificationFeed/NotificationFeed.tsx → Total Size: 3.6kB

Files in modules/feed/components/NotificationCell/NotificationCell.js:

  • ./src/modules/feed/components/NotificationCell/NotificationCell.tsx → Total Size: 3.81kB
view changes for bundle: @knocklabs/react-core-react-core-cjs

Assets Changed:

Asset Name Size Change Total Size Change (%)
modules/core/utils.js 152 bytes 1.16kB 15.14% ⚠️

Files in modules/core/utils.js:

  • ./src/modules/core/utils.ts → Total Size: 1.71kB

…te-fns quarter range

Co-authored-by: Matt Kufchak <cellomatt@users.noreply.github.com>
@codecov

codecov Bot commented Oct 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.41%. Comparing base (fb45cf0) to head (f8a7ba0).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1077      +/-   ##
==========================================
+ Coverage   75.38%   75.41%   +0.03%     
==========================================
  Files         139      139              
  Lines        4371     4377       +6     
  Branches     1283     1287       +4     
==========================================
+ Hits         3295     3301       +6     
  Misses        976      976              
  Partials      100      100              
Files with missing lines Coverage Δ
packages/react-core/src/modules/core/utils.ts 96.87% <100.00%> (+0.57%) ⬆️
...d/components/NotificationCell/NotificationCell.tsx 54.34% <100.00%> (+1.01%) ⬆️
...d/components/NotificationFeed/NotificationFeed.tsx 77.77% <ø> (ø)

@cellomatt
cellomatt merged commit 33f3365 into main Oct 8, 2026
12 checks passed
@cellomatt
cellomatt deleted the cursor/limit-feed-timestamp-quarters-4d22 branch October 8, 2026 17:05

This branch was successfully deployed

4 active deployments
Preview – javascript-nextjs-example — f8a7ba03 Deployed Oct 8, 2026 by vercel[bot]
Preview – javascript-slack-connect-example — f8a7ba03 Deployed Oct 8, 2026 by vercel[bot]
Preview – javascript-ms-teams-connect-example — f8a7ba03 Deployed Oct 8, 2026 by vercel[bot]
Preview – javascript-slack-kit-example — f8a7ba03 Deployed Oct 8, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants