An open API service indexing awesome lists of open source software.

https://github.com/holsee/string_date_parser

Kata for string date parsing
https://github.com/holsee/string_date_parser

Last synced: 2 months ago
JSON representation

Kata for string date parsing

Awesome Lists containing this project

README

        

# Date String Parser

Should take a string representing a period of time and return a number of milliseconds representing the amount of time.

The string should be of the form

`1y 2w 3d 4m`

Where `y` is year, `w` is week, `d` is day and `m` is minute (if that isn't obvious)

Should
- accept the arguments in any order i.e. `1d 3w` is valid
- accept decimal points i.e. `1.3w` weeks

Should not
- accept more than one of each denomination i.e. '1y 1y' is invalid
- accept minus numbers i.e.

## Bonus Points
A function which takes the output of the original function and returns a string of the format shown above.