Skip to content

janovesk/FluentTime

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FluentTime

A fluent interface in .NET for working with dates and times, inspired by ActiveSupport's active_support/core_ext/numeric/time extensions.

Do stuff like this:

var toothBrushingTime = 10.Minutes().Before(bedTime);
var lightsOutForReal = 1.Hour(30.Minutes()).After(bedTime);
...
Assert.That(actual, Is.LessThan(50.Milliseconds().After(expected)));
...
var bestDaysOfMyLife = 30.Days().Ago();
...
var movingAppointment = 15.May(2011).At(2).PM();
...
var allPlayAndNoWork = Today.At(16, 00);
... 
var sushiTime = Yesterday.At(21, 00);
...
var workAgain = Tomorrow.At(08, 00);

The "Before" and "After" stuff supports both DateTime and DateTimeOffset and returns the same type you start with. The Offset of the input DateTimeOffset is maintained.

Look at the tests for details.


Copyright 2011 ThoughtWorks, Inc. See LICENSE.txt for licensing info.

About

A fluent interface in C# for working with dates and times on the .NET framework

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 100.0%