/mako_datetime_converter

.NET/C# package to convert between German "Gastag" and "Stromtag", between inclusive and exclusive end dates and combinations of all them. This is relevant for German Marktkommunikation ("MaKo")

Primary LanguageC#MIT LicenseMIT

mako_datetime_converter (C#)

.NET nuget package to convert date times between German "Gastag" and "Stromtag", between inclusive and exclusive end dates and combinations of all them. This is relevant for German Marktkommunikation ("MaKo").

There is Golang port of this library: mako_time_converter (go).

Rationale

The German Marktkommunikation ("MaKo") defines some rules regarding date times:

  • you shall communicate end dates as exclusive (which is generally a good idea)
  • you shall use UTC date times with a specified UTC offset (which is a good idea)
  • and you shall always use UTC-offset 0 (a rule with good intentions)
  • in electricity all days start and end at midnight of German local time
  • but in gas all days start and end at 6am German local time ("Gas-Tag")

Now imagine there is an interface between two systems:

  • one of your systems obeys all of the above rules
  • but another one works differently (e.g. models end dates inclusively or is unaware of the differences between electricity and gas)

Then you need a conversion logic for your date times. This library does the conversion for you.

This library does not convert date times to/from UTC. It expects your application to work with DateTimeKind.Utc only, because everything else is doomed to fail and fixing your timezone problems is out of scope for this library.

How to use this Library

See the minimal working example.

Nuget Packages

This repository is available as nuget package:

Code Quality / Production Readiness

  • The code has a 100% unit test coverage. ✔️
  • The package has no dependencies itself. ✔️

Release Workflow

To create a pre-release nuget package, create a tag of the form prerelease-vx.y.z where x.y.z is the semantic version of the pre-release. This will create and push nuget packages with the specified version x.y.z and a -betaYYYYMMDDHHmmss suffix.

To create a release nuget package, create a tag of the form vx.y.z where x.y.z is the semantic version of the release. This will create and push nuget packages with the specified version x.y.z.