Skip to content
pubscout

iso_duration_parser

1.1.1, released 5 years ago by an unverified publisher

Parses and formats ISO 8601 duration strings into individual duration parts.

WASM-ready
$ flutter pub add iso_duration_parser
Source repository

What it does

A package that parses ISO 8601 duration formats (PnYnMnDTnHnMnS) into a dedicated IsoDuration object. It allows developers to extract individual duration components, calculate total seconds, perform formatting, and manipulate DateTimes.

AI-written summary of version 1.1.1, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need to parse ISO 8601 duration responses from REST APIs.
  • You want to add or subtract ISO 8601 durations from Dart DateTime objects.
  • You need to format duration intervals into readable strings.

Skip it when

  • You only need standard Dart core Durations without ISO string parsing.

Strengths

  • Supports parsing negative durations and decimals (with comma and dots).
  • Provides helper methods for DateTime manipulation and formatting.
  • No external dependencies.

Weaknesses

  • Limited to ISO 8601 duration parsing and formatting.

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
0
final dur = IsoDuration.parse('PT36H');
dur.hours; // 36.0
dur.toSeconds(); // 129600.0
dur.toIso(); // 'PT36H'

Alternatives

Packages that do the same job and could replace iso_duration_parser.

  • iso8601_duration

    A package to parse ISO 8601 duration strings.

  • money2

    High-precision library for storing, parsing, formatting, and performing arithmetic on money.

  • any_date

    Parse strings in any format or language into DateTime objects, respecting ISO and RFC standards.

  • isoweek

    Lightweight Dart package providing the Week class based on the ISO 8601 format.