logoalt Hacker News

netghostyesterday at 6:21 PM1 replyview on HN

If this is comedy, sign me up for tragedy.

This feels like something that must be the root of innumerable small and easily overlooked bugs out there.


Replies

tshaddoxyesterday at 6:45 PM

It's a common source of off-by-one date formatting bugs in client-rendered web apps, particularly ones that pass around "YYYY-MM-DD" date strings (common for OpenAPI JSON APIs).

  const dateStringFromApiResponse = "2026-01-12";
  const date = new Date(dateStringFromApiResponse);
  const formatter = new Intl.DateTimeFormat('en-US', { dateStyle: 'long' });
  formatter.format(new Date("2026-01-12"));

  // 'January 11, 2026'
show 1 reply