Skip to content
/ Timely Public

Timely (or Timely Extensions) is a small C# Library that gives you some shortcuts for Dates and TimeSpan.

License

Notifications You must be signed in to change notification settings

rGunti/Timely

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Timely

Timely (or Timely Extensions) is a small C# Library that gives you some shortcuts for Dates and TimeSpan. With these you can do stuff like 15.February(1996) or 16.Minutes() + 20.Seconds().

Methods

Date Extensions

With DateExtensions you can write dates in a natural way. It uses the in Europe commonly used dd-MMM-yyyy syntax. To write 15th February 1996 you can write the following:

15.February(1996)
// or
15.Feb(1996)

You can leave the year parameter empty to use the current year.

15.Feb()  // => returns "15th February 2017" in the year 2017

API Syntax

DateTime <int:day>.<month>([<year>])

Methods

All these methods return a DateTime instance.

  • Jan([int? year]) or January([int? year])
  • Feb([int? year]) or February([int? year])
  • Mar([int? year]) or March([int? year])
  • Apr([int? year]) or April([int? year])
  • May([int? year]) (no short hand here, May is already short enough)
  • Jun([int? year]) or June([int? year])
  • Jul([int? year]) or July([int? year])
  • Aug([int? year]) or August([int? year])
  • Sep([int? year]) or September([int? year])
  • Oct([int? year]) or October([int? year])
  • Nov([int? year]) or November([int? year])
  • Dec([int? year]) or December([int? year])

Time Extensions

With TimeExtensions you can create simple TimeSpans from a simple query.

16.Minutes()  // => returns a new TimeSpan with 16 minutes

If you want to create a specific TimeSpan with e.g. minutes and seconds you can just add two queries together:

16.Minutes() + 20.Seconds() // => return 16:20 min

API Syntax

TimeSpan <int:amount>.<unit>()

Methods

All these methods return a TimeSpan instance.

  • Milliseconds()
  • Seconds()
  • Minutes()
  • Hours()
  • Days()

Purpose of this project

This project is just a test for me to learn how to write Unit Tests in VS2017 and how to publish a NuGet package.

That being said I hope someone finds this package useful and uses it.

License

This project is licensed under the MIT License. See LICENSE for more info.

About

Timely (or Timely Extensions) is a small C# Library that gives you some shortcuts for Dates and TimeSpan.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages