UTCOffsetValue.fromCrawledStringValue constructor
UTCOffsetValue.fromCrawledStringValue(
- String value
Implementation
factory UTCOffsetValue.fromCrawledStringValue(String value) {
int negativeMultiplier = 1;
int intVal;
if (num.tryParse(value[0]) == null) {
negativeMultiplier = value[0] == "-" ? -1 : 1;
intVal = int.parse(value.substring(1));
} else {
intVal = int.parse(value);
}
intVal *= negativeMultiplier;
final minutes = intVal.remainder(100);
final hours = ((intVal - minutes) / 100).floor();
return UTCOffsetValue(
Duration(
hours: hours,
minutes: minutes,
),
);
}