DJ-73: migrate backend off joda-time to java.time and show relative timestamps in the frontend - #212
Open
devin-ai-integration[bot] wants to merge 7 commits into
Open
Conversation
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Removes the deprecated
joda-timedependency from the backend (migrating tojava.time.Instant) and replaces the frontend's statictoDateString()timestamps with relative times plus a full-date tooltip. DJ-73.The constraint that shaped the backend work: the API date contract had to stay byte-identical. Joda's
ISODateTimeFormat.dateTime().withZoneUTC()always emits 3-digit millis (2026-07-29T20:57:31.000Z), whileInstant.toString()drops trailing-zero millis (...31Z), so every serialization path goes through one explicit formatter instead:used by
JacksonCustomizations.DateTimeSerializer(nowStdSerializer<Instant>) and by both GraphQL datafetchers, replacing the per-callISODateTimeFormat...print(...). Everything else is a type swap:Article/Comment/ArticleData/CommentDatafields,CursorPageParameter<DateTime>→<Instant>, andDateTimeHandlerbecomesTypeHandler<Instant>(@MappedTypes(Instant.class)) keeping the identical UTC-Calendar/Timestampround-trip.DateTimeCursorkeeps emitting raw epoch millis (getMillis()→toEpochMilli(),new DateTime().withMillis(x)→Instant.ofEpochMilli(x)).Frontend adds
frontend/lib/utils/relativeTime.ts— no new runtime deps, justIntl.RelativeTimeFormat— exportinggetRelativeTime(iso, now?)(largest sensible unit,"just now"under 10s,""for invalid/empty input) andgetFullDate(iso)for the tooltip:ArticleType.createdAt/updatedAtwere typednumberwhile the API has always returned ISO strings; corrected tostring.TypeScript moves
^3.9.7→4.9.5becauseIntl.RelativeTimeFormattypings don't exist before 4.1 — on 3.9.10 the build fails witherror TS2339: Property 'RelativeTimeFormat' does not exist on type 'typeof Intl'.jest/ts-jest/@types/jestare added as dev deps for the new unit tests.Tests
New unit tests:
DateTimeFormatsTest(asserts whole-second instants serialize as...:31.000Z, not...:31Z, plus a.123Zcase, over both the Jackson and datafetcher paths),DateTimeCursorTest(cursor string == epoch millis, encode→decode round-trip),DateTimeHandlerTest(symmetric UTCTimestampconversion), andfrontend/lib/utils/relativeTime.test.ts(17 cases: every unit boundary, the exact.000ZAPI format, future dates, invalid/empty input, tooltip helper).Verification:
./gradlew clean test spotlessCheckpasses (72 tests, 0 failures;jacocoTestCoverageVerificationfails at 0.33 vs 0.80 both here and on unmodifiedmain, so it is pre-existing and untouched). Frontend:npm test17/17,npx tsc --noEmitclean,next buildcompiles.grep -rn joda src/ build.gradleis empty.Live check against the running app —
curl http://localhost:8080/articlesstill returns"createdAt":"2026-07-29T21:26:19.000Z", matching^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$for every article, same field shape as the pre-migration capture.Home feed: before / after
Full date on hover:
Link to Devin session: https://partner-workshops.devinenterprise.com/sessions/6c3903acf9244ec4b20cd69300aede02
Requested by: @HJscarr