79289802

Date: 2024-12-18 02:13:00
Score: 0.5
Natty:
Report link

To break this down, I’d suggest splitting it into two parts: 'date' and 'time'.

1. Date

The 'date' part is all about recurrence patterns—things like:

You can manage these patterns with custom logic, or, if you're looking for a simpler way to handle it, you might want to check out libraries like DateRecurrenceR (github). It can help with generating recurring dates based on different patterns, making the logic easier to handle.

using DateRecurrenceR;
using DateRecurrenceR.Core;

var beginDate = DateOnly.MinValue;
var endDate = DateOnly.MaxValue;
var interval = new Interval(3);

var enumerator = Recurrence.Daily(beginDate, endDate, interval);

2. Time

The 'time' part is about dealing with time zones, UTC, and local times. This can get tricky because recurring events can span across time zones, and daylight-saving time changes can mess things up. For that, I’d recommend checking out some advice from @matt-johnson-pint. His approach with NodaTime and using UTC can help avoid common headaches with time calculations.

Reasons:
  • Long answer (-1):
  • Has code block (-0.5):
  • User mentioned (1): @matt-johnson-pint
  • Low reputation (1):
Posted by: user1645745