Time Period Library for .NET

Extensive time period calculations and individual calendar periods.

A while ago we had to write an EPG for a WP8 TV app that we’re building for a client. As part of this we had the need to do some pretty difficult DateTime calculations.

Finding out if a C# DateTime is within a time range is hard. Finding out if two time ranges intersect is even harder!

Install this little Nuget package and you can do stuff like:

var cellTimeRange = new TimeRange(nowTime.AddHours(-2), nowTime.AddHours(3));
var timeCellsInRange = cell.TimeCells.Where(_ => new TimeRange(_.StartTime, _.EndTime).IntersectsWith(cellTimeRange)).ToList();


How cool is that!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s