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

| by Anand Narayanaswamy Follow 0 Followers on Nov 27, 2013. Estimated reading time: 1 minute |

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.

Rate this Article

Adoption Stage

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread
Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread


Educational Content

Login to InfoQ to interact with what matters most to you.

Recover your password...


Follow your favorite topics and editors

Quick overview of most important highlights in the industry and on the site.


More signal, less noise

Build your own feed by choosing topics you want to read about and editors you want to hear from.


Stay up-to-date

Set up your notifications and don't miss out on content that matters to you