The ETA That Went Negative — JavaScript Bug Hunt
Inspired by ride-hailing apps showing "-1 min" while your driver waits outside.
- Language: JavaScript
- Layer: Frontend
- Difficulty: Easy
- Concepts: Formatting, Math
- Modelled on: Uber
- Visible tests: under 30 seconds is Arriving now; partial minutes round up; negative time never shows
- Reward: 50 XP for a complete fix
Briefing
Inspired by ride-hailing apps showing "-1 min" while your driver waits outside. The ETA label must never go below "Arriving now", and partial minutes always round up — a driver 61 seconds away is "2 min", not "1 min".
Fix eta.js.
Bug report
BUG-404MIN · Reported by: rider app
formatEta(msRemaining):
- under 30 seconds (including anything negative) -> "Arriving now"
- otherwise ceil to whole minutes -> "N min"
Observed: "0 min" at 20s and "-1 min" after arrival.
Logs
[eta] remaining=-32000 label="-1 min"The code as shipped
src/ride/eta.js (editable)
// Human label for the ride ETA.
exports.formatEta = function (msRemaining) {
var minutes = Math.floor(msRemaining / 60000);
return minutes + " min";
};
Open the hunt to edit the files, run the visible tests and submit against the hidden ones. More JavaScript bug hunts.