Vpavkin Dtc Versions Save

Provides type classes for datetime values. Works both on JVM & ScalaJS.

v2.6.0

1 year ago

v2.4.0

4 years ago

v2.3.1

4 years ago

Scala 2.13 support.

v2.0.0-M1

6 years ago

2.0.0-M1

This major release aims to fix a specific design flaw, which is impossibility to construct Local values from zone-aware instants. Prior to 2.0, such option was an exclusive privilege of Zoned.

In practice this introduced limitations in correctly abstracting over UTC/Zoned time representations. Inability to grasp this aspect from the beginning leaded to creation of arcane localDateTimeAsZoned instance. This trick allowed to use LocalDateTime in Zoned context, which provided an ability to construct values polymorphically. Such abuse created it's own issues, in particular - ability to create LocalDateTime values in some Zoned contexts, where it didn't make any sense.

Version 2.0 resolves this issue by extracting time creation functionality in a separate Capture typeclass.

Now it's possible to specify an exact polymorphic context you need:

  • TimePoint for a generic instant
  • TimePoint + Capture for a generic instant that can be constructed in a instant-preserving way.
  • Zoned for a zone-aware value for full control over zoning (no locals here from now on)
  • Local specifically for local (or UTC) instant, without zone information and control over it.

Migration from 1.* to 2.0.0-M1:

  • Now there's no Zoned instance for LocalDateTime.

    For each place you use it there're two options:

    • It's zoned-only code, that doesn't make any sense in local context. In such case you have a better protection now from accidentally using it in an incorrect context.
    • It's an abstraction over UTC/Zoned contexts. In such case you should be able to replace the context bound from Zoned to TimePoint + Capture.
  • Zoned.of[T](...) was removed. Use Capture[T](...)

  • Lawless was renamed to TimePoint.

Other potentially breaking changes:

  • Explicit implementation of hashCode was added to moment wrapper classes, which can lead to different behaviour in Maps.
  • [Laws] Zoned.constructorConsistency law is gone. Proper laws for Capture are work in progress.