time_parser 1.0.0 copy "time_parser: ^1.0.0" to clipboard
time_parser: ^1.0.0 copied to clipboard

outdated

parses a time string and returns a time object in order to easily access hours and minutes.

A library for Dart developers.

Created from templates made available by Stagehand under a BSD-style license.

Format #

A valid time string has the format:

^([0-1]?[0-9]|2[0-3]):[0-5][0-9]$

Usage #

A simple usage example:

Parsing a valid time string

import 'package:time_parser/time_parser.dart';

void main() {
  var time = Time.parse('15:30');
  print('hours: ${time.hours}, minutes: ${time.minutes}');
}

An Exception is thrown when time string is not valid

import 'package:time_parser/time_parser.dart';

void main() {
   try {
    TimeParser.parse('xx:xx');
  } catch(TimeParseException) {
    print(e); // TimeParseException: invalid timeString: xx:xx
  }
}

Features and bugs #

Please file feature requests and bugs at the issue tracker.

1
likes
0
pub points
33%
popularity

Publisher

unverified uploader

parses a time string and returns a time object in order to easily access hours and minutes.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

More

Packages that depend on time_parser