Occurify.TimeZones 0.1.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Occurify.TimeZones --version 0.1.0
                    
NuGet\Install-Package Occurify.TimeZones -Version 0.1.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Occurify.TimeZones" Version="0.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Occurify.TimeZones" Version="0.1.0" />
                    
Directory.Packages.props
<PackageReference Include="Occurify.TimeZones" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Occurify.TimeZones --version 0.1.0
                    
#r "nuget: Occurify.TimeZones, 0.1.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#addin nuget:?package=Occurify.TimeZones&version=0.1.0
                    
Install Occurify.TimeZones as a Cake Addin
#tool nuget:?package=Occurify.TimeZones&version=0.1.0
                    
Install Occurify.TimeZones as a Cake Tool

Occurify.TimeZones

Time zone and cron expression support for Occurify: Filter, manipulate, and schedule instants and periods across time zones.

Overview

  • Supports time zone based instants and periods (e.g. time of day, day, week, etc).
  • Supports both forwards and backwards iteration through Cron instants and periods.
  • Uses the Cronos library to enable Cron functionality that:
  • Supports standard Cron format with optional seconds.
  • Supports time zones, and performs all the date/time conversions for you.
  • Does not skip occurrences, when the clock jumps forward to daylight saving time (known as Summer time).
  • Does not skip interval-based occurrences, when the clock jumps backward from Summer time.
  • Does not retry non-interval based occurrences, when the clock jumps backward from Summer time.

For details on the Occurify ecosystem including examples for this library, please check the following documentation: Occurify main README.

Installation

Occurify.TimeZones is distributed as a NuGet package, you can install it from the official NuGet Gallery. Please use the following command to install it using the NuGet Package Manager Console window.

PM> Install-Package Occurify.TimeZones

Usage

Rather than working with concrete instants and periods in time, Occurify allows for conceptual representation of time using intstant and period timelines.

For example, rather than listing all workdays of a year to work with, you can define the concept of "all workdays", apply transformations or filters, and extract the relevant periods as needed.

The following example demonstrates how to define a period timeline, workingHours that includes all periods between 8 AM and 6 PM. By subtracting weekends, we obtain a new period timeline, workingTime, that represents all workdays within that range:

IPeriodTimeline workingHours = TimeZonePeriods.Between(startHour: 8, endHour: 18);
IPeriodTimeline weekends = TimeZonePeriods.Days(DayOfWeek.Saturday, DayOfWeek.Sunday);
IPeriodTimeline workingTime = workingHours - weekends;

Now, workingTime represents all workdays from 8 AM and 6 PM.

Console.WriteLine(workingTime.IsNow() ? "You should still be working" : "You can go home!");

Or

Console.WriteLine($"The year 1025 contained {workingTime.EnumeratePeriod(TimeZonePeriods.Year(1025)).Count()} workdays.");
Console.WriteLine($"The year 3025 will contain {workingTime.EnumeratePeriod(TimeZonePeriods.Year(3025)).Count()} workdays.");

The period timeline only resolves the necessary periods when enumerated, ensuring efficiency.

This approach allows developers to focus on what they need—such as "workdays"—without manually managing time calculations. As a result, coding becomes more intuitive and use case-driven.

License

Copyright © 2025 Jasper Lammers. Occurify.TimeZones is licensed under The MIT License (MIT).

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.5.1 35 4/7/2025
0.5.0 44 4/5/2025
0.4.0 109 4/1/2025
0.3.0 79 3/29/2025
0.2.0 258 3/23/2025
0.1.2 84 3/21/2025
0.1.1 135 3/19/2025
0.1.0 142 3/13/2025