Spot the problem in this AI code

TypeScript. The task: "Write a TypeScript function that turns a due date like 2026-12-01 into a label like Dec 1, 2026." Read the code, then pick what goes wrong.

dueDate.ts
// Turns "2026-12-01" into "Dec 1, 2026"
export function dueDateLabel(isoDate: string): string {
  const d = new Date(isoDate);
  const months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun",
    "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
  return `${months[d.getMonth()]} ${d.getDate()}, ${d.getFullYear()}`;
}

A user in New York has a task due 2027-01-01. What goes wrong?

  1. West of UTC it shows the day before, so 2027-01-01 reads Dec 31, 2026
  2. getMonth() starts at 1, so January shows up as Feb
  3. East of UTC it shows the day after, so users in Tokyo see Jan 2, 2027
  4. new Date() throws on a date with no time part, so the page crashes

Show the answerHide the answer

Answer A: West of UTC it shows the day before, so 2027-01-01 reads Dec 31, 2026

We ran dueDateLabel("2027-01-01") with the time zone set to America/New_York and got Dec 31, 2026, while UTC and Asia/Tokyo gave Jan 1, 2027. A date written with no time is read as midnight UTC, and getDate() then reports the local day, which in New York is still Dec 31. Appending T00:00:00 to the string, so it is read as local midnight, printed Jan 1, 2027 in every time zone we tried.

The fix: dueDate.ts
// Turns "2026-12-01" into "Dec 1, 2026"
export function dueDateLabel(isoDate: string): string {
  const d = new Date(isoDate + "T00:00:00");
  const months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun",
    "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
  return `${months[d.getMonth()]} ${d.getDate()}, ${d.getFullYear()}`;
}

Explain it at your depth

The code is already in the box below. Pick a level and press Explain it, and Vibe explains it in plain English. Free, no account.

dueDate.ts

Up to 1,500 characters (about 60 lines). Your code is sent to Unvibe and Anthropic to write the explanation. Don't paste keys or passwords. Common key formats are refused.

Vibe8 lines selected

Press Explain it for the sample, or paste your own code first.

Explain code beside your editor

When your AI tool writes code, select the code in any app and press the shortcut. On a Mac that's Control+U, not Command+U (⌘U only works in Cursor and VS Code with the editor bridge). On Windows it's Ctrl+Alt+U. Vibe explains it beside your editor, you can ask it why, and Test me checks that you followed. Unvibe is a free app for Mac and Windows.

Install on Mac

curl -fsSL https://unvibe.site/install.sh | bash

Paste into Terminal. Unvibe isn't notarized by Apple yet, so this is the smooth path.

No install warning? Use Unvibe in your browser

Opening the .dmg the first time
  1. Open the .dmg and drag Unvibe to Applications.
  2. Open it once; macOS says it can't verify it. Click Done, not the blue Move to Trash.
    macOS dialog: “Unvibe” Not Opened, with a blue Move to Trash button on top and Done under it
    Real screen, macOS 26. On macOS 15 the two buttons sit side by side.
  3. System Settings › Privacy & Security, scroll down to Security, then press Open Anyway. Confirm, then enter your Mac password. The button shows for about an hour after you try to open Unvibe.
    macOS Privacy & Security, Security section: Unvibe was blocked to protect your Mac, with the Open Anyway button
    Real screen, macOS 15

The Terminal line checks the download against the published SHA-256 and Unvibe's self-signed signature before it installs anything. More help with the first open