namespace Elternbeirat.Web.Features.Layout;
///
/// Works out the year shown in the footer's copyright line.
///
///
/// The container runs on UTC, but visitors live in Germany. Taking the year
/// straight from the server clock would show the old year for the first hour
/// (two in summer time) of every new year, so the instant is converted to
/// Europe/Berlin first.
///
public static class FooterYear
{
///
/// IANA id; resolves on every platform .NET supports, Windows included.
///
private static readonly TimeZoneInfo Berlin =
TimeZoneInfo.FindSystemTimeZoneById("Europe/Berlin");
///
/// Returns the calendar year in Berlin at the given instant.
///
///
/// The current instant, in any offset; usually
/// .
///
/// The year a visitor in Germany would see on their calendar.
///
///
/// FooterYear.For(new DateTimeOffset(2026, 12, 31, 23, 30, 0, TimeSpan.Zero)); // 2027
///
///
public static int For(DateTimeOffset now) =>
TimeZoneInfo.ConvertTime(now, Berlin).Year;
}