DEV Community

Daniel Pertu
Daniel Pertu

Posted on

179 deadline rows, and "Not announced" is a value in the type rather than a null

UK graduate recruitment runs on dates. Spring weeks open in September, close in November, and a candidate who finds out in January is a year late. So we built four tables of them: spring weeks, summer internships, graduate schemes and law vacation schemes.

179 rows, 101 employers, 2,289 lines in one data file. The interesting part is not the scraping, because there was none. It is the type.

A deadline cell is not a date

The naive model is opens: string | null. That null is doing at least three jobs, and the difference between them is the whole value of the page:

export type DeadlineCell =
  | { kind: 'date'; iso: string; reportedBy?: string }
  /** Opening only: accepting applications when checked, with no opening date published. */
  | { kind: 'open' }
  /** Closing only: reviewed as applications arrive, with no fixed closing date. */
  | { kind: 'rolling'; reportedBy?: string }
  | { kind: 'not-announced' };
Enter fullscreen mode Exit fullscreen mode
  • not-announced means we looked and the employer has published nothing. It is an authored claim, not a missing field.
  • open means the application form was accepting submissions when we checked, with no opening date anywhere.
  • rolling means the employer says it reviews as applications arrive and will not give a closing date.

Across 358 cells: 236 dates, 66 not announced, 42 open, 14 rolling. If all 122 of those non-dates had been nulls rendered as a dash, a third of the table would have said nothing while looking like it had failed to load.

Because kind is a discriminant, the renderer is an exhaustive switch with no default case, so adding a fifth kind is a type error at the one place that has to care:

switch (cell.kind) {
  case 'date': /* formatted date, plus "reported" and "May close early" */
  case 'open': return <span>Open, no date given</span>;
  case 'rolling': /* "Rolling", plus "reported" */
  case 'not-announced': return <span className="text-muted-foreground">Not announced</span>;
}
Enter fullscreen mode Exit fullscreen mode

One type, two columns, and the asymmetry lives in the test

An opening date can never be "rolling", and a closing date can never be "open". That could be two unions. We kept one and put the asymmetry in the guard test:

expect(row.opens.kind, where).not.toBe('rolling');
expect(row.closes.kind, where).not.toBe('open');
Enter fullscreen mode Exit fullscreen mode

Two assertions over 179 rows, against two extra interface types and the conversion functions between them. For data this size the test is the better trade, and the failure message names the employer and the programme.

The same test does the work a type cannot:

// The 2026/27 cycle: nothing before mid-2026 or after the summer of 2027.
expect(iso >= '2026-05-01' && iso <= '2027-09-30', `${where}: ${iso}`).toBe(true);
if (row.opens.kind === 'date' && row.closes.kind === 'date') {
  expect(row.opens.iso <= row.closes.iso, where).toBe(true);
}
Enter fullscreen mode Exit fullscreen mode

A mistyped year is the single most likely error in a hand-written date table, and it is invisible in review: 2027-01-15 and 2026-01-15 look identical at a glance, and the second one is in the past.

The rule that costs the most rows

The file's header states six rules. This is the one that gets argued about:

3. A date nobody publishes is NOT_ANNOUNCED. Never carry a date forward from
   the previous cycle, and never infer one from it.
Enter fullscreen mode Exit fullscreen mode

Last year's date is tempting. It is nearly always close, the page looks complete, and a table full of "Not announced" looks lazy. It is also the one error with a real cost: a candidate who plans around a carried-forward date and finds the form shut is worse off than one who knows we do not know. 66 cells say "Not announced" and every one of them is that rule being kept.

Provenance per cell, and it shows

Dates come from the employer's own careers page wherever one exists. Where only a graduate jobs site has it, the cell carries who said so:

function on(iso: string, reportedBy?: string): DeadlineCell {
  return reportedBy ? { kind: 'date', iso, reportedBy } : { kind: 'date', iso };
}
Enter fullscreen mode Exit fullscreen mode

61 of the 358 cells are second hand, attributed to seven trackers (Trackr, Legal Cheek, TARGETjobs, AnitaB.org, RateMyPlacement, Gradcracker, AllAboutLaw), and the page renders a small "reported" under the date with the reporter in a title:

function Reported({ by }: { by?: string }) {
  if (!by) return null;
  return (
    <span className="text-muted-foreground block text-xs" title={`Reported by ${by}`}>
      reported
    </span>
  );
}
Enter fullscreen mode Exit fullscreen mode

The 214 source URLs behind the rows, across 102 distinct hosts, are not rendered at all. They are the editor's record, so the next refresh reopens exactly what was read, and checkedOn is per row while updatedOn is per table and is the only one a reader sees ("Updated November 2026").

The Apply link has its own rule, and its own assertion:

expect(
  AGGREGATORS.some((domain) => row.link.includes(domain)),
  `${where} links to a jobs board`
).toBe(false);
Enter fullscreen mode Exit fullscreen mode

A jobs board can be where we found the date. It is never where we send the candidate. 179 rows, 109 distinct link hosts, all of them employers' own domains and portals.

The employer-to-provider claim this file is not allowed to make

Each deadline page ends with the assessment providers those employers use, which is the commercial point of the page. A row cannot state that:

6. `employerSlug` is set only where lib/games/employer-assessments.ts already
   has a profile. The provider links on each page are derived from that file,
   so this file cannot add an employer-to-provider claim.
Enter fullscreen mode Exit fullscreen mode

80 of the 179 rows carry a slug, and the derived list comes out at 9, 17, 9 and 4 employers per page, filtered to those the evidence file links to a provider at medium confidence or better. The guard test then checks every derived provider has a hub page, so a renamed provider breaks the build rather than shipping a dead link in the one block on the page we actually want clicked.

The date formatter is written by hand

/** '2026-11-02' to '2 Nov 2026'. Parsed by hand so no time zone can shift the day. */
export function formatDeadlineDate(iso: string): string {
  const [year, month, day] = iso.split('-').map(Number);
  return `${day} ${MONTHS[month - 1]} ${year}`;
}
Enter fullscreen mode Exit fullscreen mode

new Date('2026-11-02') is midnight UTC. Format that in a negative offset and your deadline renders as 1 November. These pages are read in London, New York and Singapore from one prerendered HTML file, and a server-rendered date that is a day early on a deadline page is the worst possible place for that bug. Three lines of string arithmetic, no Date object, no library.

Mobile

The mobile answer for this table is the one case where a sideways scroller is correct: a deadline row is three facts and a link, and splitting it into stacked cards costs the comparison the table exists for. So the columns stay, the scroll lives inside a bordered container (overflow-x-auto on the wrapper, min-w-[42rem] on the table), and the page itself never scrolls horizontally at 375px.

See it

Open the spring week table:

  • Find the greyed "Not announced" cells. 16 of the 76 cells on that page are that value, which is the state the type exists for.
  • Find a date with "reported" under it and hover the word: the title names which tracker published it. 32 cells on that page are attributed that way.
  • 19 of its 38 rows carry "May close early", which is the honest answer to "when is the deadline" for most of UK banking. Across all four tables it is 75 of 179 rows.
  • Then open the summer internship table, which has "Rolling" and "Open, no date given" rows the spring week page has none of, because its employers recruit differently.
  • Every Apply link goes to an employer's own domain. The dates in the source list sometimes came from elsewhere; the links never do.

If you are modelling dates somebody will plan around, the thing I would copy from this is the four-case union. "We checked and nobody has said" is a fact, and it deserves a representation that is not a null.

Top comments (0)