Noda Time 1.2 Released with XML, JSON Serialization and Text Formatting

Noda Time 1.2 has been released with support for XML and binary serialization and text formatting in addition to an optional assembly to handle JSON serialization. It provides an ability to format and parse Duration, OffsetDateTime, and ZonedDateTime types and includes Interval.Contains(), ZonedDateTime.Calendar() methods in addition to several bug fixes.

The recent release provides support for NodaTime.Serialization.JsonNet assembly which is built using Json.NET 4.5.11 and is available for both portable and desktop platforms. Moreover, an extension method of ConfigureForNodaTime is provided on JsonSerializer, JsonSerializerSettings and NodaConverters type provides public static read-only fields for individual converters, where all of them are immutable. Alternatively, custom converters can be created easily from patterns using NodaPatternConverter.

Noda Time 1.2 has added several API changes such as introducing new classes such as DurationPattern, OffsetDateTimePattern and ZonedDateTimePattern that represent patterns for parsing and formatting Duration, OffsetDateTime, and ZonedDateTime respectively. It also introduces new properties such as GeneralIsoPattern, BclRoundtripPattern and FullRoundtripPattern which provide programmatic access to the o/O, r and s patterns. The release also sealed DateTimeZoneNotFoundException, CalendarSystem and InvalidNodaDataException.

In Noda Time 1.2, the types Instant, OffsetDateTime, ZonedDateTime, LocalDateTime, LocalDate, LocalTime, Offset, Interval, Duration, PeriodBuilder implement IXmlSerializable and can be serialized. Moreover, these type also implement ISerializable and can be serialized using BinaryFormatter by using [Serializable] attribute.

The recent release also includes InstantPattern.WithMinMaxLabels(), which provides an ability to replace text used to format the minimum and maximum instants in addition to the new Era.AnnoMartyrum which is a replacement to previously misnamed AnnoMartyrm. It also adds Interval.Contains(), ZonedDateTime.Calendar and ZonedDateTime.GetZoneInterval() methods in addition to ParseResult.Exception, which provides direct access to the exception that would be thrown by GetValueOrThrow() method.

Noda Time 1.2 has fixed a bug where Period.Between() could return a mixture of positive and negative values when called with end-of-month and near-leap-year values in addition to fixing a incorrect overflow when creating a Period that exceeded long.MaxValue ticks. The release also removed support for upper-case aliases for the existing Instant patterns n, g, and d.

InfoQ Weekly Newsletter

Join a community of over 250 K senior developers by signing up for our newsletter. If you are based in the EEA, please contact us so we can provide you with the protections afforded to you under EEA protection laws.

Is your profile up-to-date? Please take a moment to review and update.

Email Address

Note: If updating/changing your email, a validation request will be sent

Company name:

Keep current company name

Update Company name to:

Company role:

Keep current company role

Update company role to:

Company size:

Keep current company Size

Update company size to:

Country/Zone:

Keep current country/zone

Update country/zone to:

State/Province/Region:

Keep current state/province/region

Update state/province/region to:

Subscribe to our newsletter?

Subscribe to our architect newsletter?

Subscribe to our industry email notices?

By subscribing to this email, we may send you content based on your previous topic interests. See our privacy notice for details.

You will be sent an email to validate the new email address. This pop-up will close itself in a few moments.

We notice you're using an ad blocker

We understand why you use ad blockers. However to keep InfoQ free we need your support. InfoQ will not provide your data to third parties without individual opt-in consent. We only work with advertisers relevant to our readers. Please consider whitelisting us.