Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kkla320/durationparsestrategy
A parser that converts strings like "1 hour 5 minutes" to DateComponents
https://github.com/kkla320/durationparsestrategy
Last synced: 2 days ago
JSON representation
A parser that converts strings like "1 hour 5 minutes" to DateComponents
- Host: GitHub
- URL: https://github.com/kkla320/durationparsestrategy
- Owner: kkla320
- License: mit
- Created: 2023-06-21T06:45:14.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-06-22T11:39:31.000Z (over 1 year ago)
- Last Synced: 2025-01-17T04:16:57.456Z (4 days ago)
- Language: Swift
- Size: 8.79 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# DurationParseStrategy
This repository contains a ParseStrategy to convert strings like "1 hour 2 minutes" into DateComponents.
```swift
let parser: DateComponents.DurationParseStrategy()
let dateComponents = parser.parse("1 hour 2 minutes 5 seconds")print(dateComponents.hour) // Prints 1
print(dateComponents.minute) // Prints 2
print(dateComponents.second) // Prints 5```
Currently the parser supports the following languages
- English
- German