Skip to content

Commit cdedd0a

Browse files
committed
🚀 enhance time parsing with colon format
- Upgrade dependencies - Test updated
1 parent 51fc0c3 commit cdedd0a

File tree

4 files changed

+19
-3
lines changed

4 files changed

+19
-3
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## 1.4.3
2+
3+
- :sparkles: Parse time with colon format. Example: `10:30 - 11:30 AM`
4+
- :arrow_up: Upgrade dependencies
5+
16
## 1.4.2
27

38
- :bug: Fixes error that occured when subject doesn't have time info. Fixes issue [#11](https://github.com/iiumschedule/albiruni/issues/11)

lib/src/util/date_time_util.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,10 @@ class DateTimeUtil {
8383
var tempStartTime = split.first;
8484
var tempEndTime = split.last.split(" ").first;
8585

86+
// Convert colon format to dot format
87+
tempStartTime = tempStartTime.replaceAll(':', '.');
88+
tempEndTime = tempEndTime.replaceAll(':', '.');
89+
8690
if (!tempStartTime.contains('.')) tempStartTime = '$tempStartTime.00';
8791
if (!tempEndTime.contains('.')) {
8892
tempEndTime = '$tempEndTime.00';

pubspec.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: albiruni
22
description: A wrapper to easily access IIUM's Course Schedule data.
3-
version: 1.4.2
3+
version: 1.4.3
44
repository: https://github.com/iqfareez/albiruni
55
issue_tracker: https://github.com/iqfareez/albiruni/issues
66
topics:
@@ -14,10 +14,10 @@ environment:
1414
sdk: ">=3.0.0 <4.0.0"
1515

1616
dev_dependencies:
17-
lints: ^4.0.0
17+
lints: ^5.1.1
1818
test: ^1.16.0
1919

2020
dependencies:
2121
html: ^0.15.0
2222
http: ^1.1.0
23-
intl: ^0.18.0
23+
intl: ^0.20.2

test/src/util/date_time_util_test.dart

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,13 @@ void main() {
117117
expect(resTime.endTime, '22:00');
118118
});
119119

120+
test('Colon seperator', () {
121+
String rawTime = '10:30 - 11:30 AM';
122+
var resTime = DateTimeUtil.parseTime(rawTime);
123+
expect(resTime!.startTime, '10:30');
124+
expect(resTime.endTime, '11:30');
125+
});
126+
120127
group('Startime in AM but endtime in PM', () {
121128
test('Exhibit A', () {
122129
String rawTime = '11.30 - 12.50 AM';

0 commit comments

Comments
 (0)