appealDeadlineFor function
The end of the window for a complaint against a decision taken at
decidedAt, as Limenia computes it: six calendar months later, on the
last day of the target month if it is shorter (31 August to 28 February),
at the time of day of the decision. In UTC.
Limenia sends this date to reporters as appealDeadline
(ReportsResolution.appealDeadline); for the affected user the app
computes it from ModerationDecision.decidedAt.
Implementation
DateTime appealDeadlineFor(DateTime decidedAt) {
final d = decidedAt.toUtc();
final first = DateTime.utc(d.year, d.month + 6);
final lastDay = DateTime.utc(first.year, first.month + 1, 0).day;
return DateTime.utc(
first.year,
first.month,
d.day > lastDay ? lastDay : d.day,
d.hour,
d.minute,
d.second,
d.millisecond,
d.microsecond,
);
}