💾 Archived View for mfgames.com › mfgames-cil › docs › nitride › temporal captured on 2024-08-31 at 11:52:23. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2024-06-16)
-=-=-=-=-=-=-
The package `MfGames.Nitride.Temporal` extends Nitride with time- and date-centric operations, extensions, and processes. It allows a site to be hide future posts, create a calendar of entries, or create a nested set of pages based on year, month, and day.
dotnet add package MfGames.Nitride.Temporal
This also has an extension method to include it into the builder.
public static async Task<int> Main(string[] args) { NitrideBuilder builder = new NitrideBuilder(args) .UseTemporal( config => { config .WithDateTimeZone("America/Chicago") .WithDateOptionCommandLineOption(); }); return await builder.RunAsync(); }
This library is built on top of NodaTime[1], provides good time zone support, and had date-only objects before they were available in the base library.
In most cases, adding an `Instant` to an entity is sufficient to use most of the temporal functionality.
Instant instant; var entityList = new Entity[] { new Entity(instant), }; var op = context.Resolve<FilterOutFutureInstant>(); var filteredList = entityList.Run(op).ToList();
When the `WithDateOptionCommandLineOption()` is included in the module setup, it injects a `--date` option into the builders that allows a different date to be used for the “now” date which can be retrieved from the injectable `TimeService` as `CurrentInstant` and `CurrentDateTime`.
Below are various useful links within this site and to related sites (not all have been converted over to Gemini).