Show people surname first
Employee names now read "Winkler, Hannah" wherever a person appears in a list, a table, a heading or a tree node. That is the order a personnel list is kept in, it is the order people are looked up in, and it finally matches the sorting — the employee list has always been ordered by surname, which made an alphabetical page look unsorted. The name was being assembled inline in about twenty places. A rename that catches half of them is worse than none, so it now goes through fmtName in lib/format.ts and every display site calls it. Sentences keep the natural order: "Hannah Winkler wurde versetzt" reads like German, "Winkler, Hannah wurde versetzt" reads like a form. So the toasts are unchanged and only labels moved. Two things the change would have quietly broken: The org chart's own filter matched against "first last". It now matches either order, with or without the comma, so typing what you see works and so does typing what you remember. The print model sorted by the last word of the composed name, which happened to be the surname and is now the first name — every printed unit would have come out sorted by first name. It sorts on the surname field itself now, which is what it meant all along. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { addDaysIso, daysBetweenIso, fmtAge, fmtDate, initials, tenure, toIsoDate, yearsBetweenIso } from "@/lib/format";
|
||||
import { addDaysIso, daysBetweenIso, fmtAge, fmtDate, fmtFullName, fmtName, initials, tenure, toIsoDate, yearsBetweenIso } from "@/lib/format";
|
||||
|
||||
describe("fmtDate", () => {
|
||||
it("formats an ISO date string in de-AT order", () => {
|
||||
@@ -125,3 +125,35 @@ describe("toIsoDate", () => {
|
||||
expect(toIsoDate("2026-03-05T23:30:00Z")).toBe("2026-03-06");
|
||||
});
|
||||
});
|
||||
|
||||
// Die Anzeige wurde auf „Nachname, Vorname" umgestellt. Das ist die
|
||||
// Reihenfolge jeder Personalliste, und sie stimmt mit der Sortierung überein,
|
||||
// die schon immer nach Nachnamen ging.
|
||||
describe("fmtName", () => {
|
||||
it("stellt den Nachnamen voran", () => {
|
||||
expect(fmtName("Hannah", "Winkler")).toBe("Winkler, Hannah");
|
||||
});
|
||||
|
||||
it("kommt ohne Vornamen aus, ohne einen Beistrich stehen zu lassen", () => {
|
||||
expect(fmtName("", "Winkler")).toBe("Winkler");
|
||||
expect(fmtName(" ", "Winkler")).toBe("Winkler");
|
||||
});
|
||||
|
||||
it("kommt auch ohne Nachnamen aus", () => {
|
||||
expect(fmtName("Hannah", "")).toBe("Hannah");
|
||||
});
|
||||
|
||||
it("räumt Leerzeichen an den Rändern weg", () => {
|
||||
expect(fmtName(" Hannah ", " Winkler ")).toBe("Winkler, Hannah");
|
||||
});
|
||||
});
|
||||
|
||||
describe("fmtFullName", () => {
|
||||
it("lässt den Nachnamen vorne und die Titel an ihrem Platz", () => {
|
||||
expect(fmtFullName("Max", "Mustermann", ["Dr."], ["MSc", "MBA"])).toBe("Mustermann, Dr. Max, MSc MBA");
|
||||
});
|
||||
|
||||
it("verträgt fehlende Titel", () => {
|
||||
expect(fmtFullName("Max", "Mustermann", [], null)).toBe("Mustermann, Max");
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user