Code Room
Code reviewHardcr-g280
Subject CorrectnessLevel Senior–Staff~20 minCommon in Code quality & review interviewsIndustries Software development

Question

Review this Java code that computes how many whole days a subscription has been active and whether a 30-day trial has ended.

Customers span many timezones and the nightly job runs near DST transitions.

What a strong answer looks like

Separate real bugs from style. Rank issues by severity, point at the root cause rather than the symptom, and suggest a concrete fix — specific and kind.

Talk through your review
Code to reviewjava
long daysActive(Instant start, Instant now) {    long millis = now.toEpochMilli() - start.toEpochMilli();    return millis / (24 * 60 * 60 * 1000);} boolean trialExpired(Subscription sub) {    long days = daysActive(sub.startedAt(), Instant.now());    return days >= 30;} void nightlyJob(List<Subscription> subs) {    for (Subscription sub : subs) {        if (trialExpired(sub)) {            convertToPaid(sub);        }    }}
Run or narrate your approach, then ask the coach.