12-29-2017 14:44
12-29-2017 14:44
Hi there, I wonder if someone can help me...
I am using following to determine user setting...
unit.distance === "metric" ? 1: 0;
then I am using following if conditions code...
If (unit.distance == 1) {
....
} else {
....
}
My default distance unit is set to miles, but if I change it to km. It does not work and distance is still showing in miles on the clock face, but on ionic today screen it shows km. Not sure what I am doing wrong. Any help is greatly appreciated. Thanks...
Answered! Go to the Best Answer.
01-09-2018 16:53
01-09-2018 16:53
Are you importing units from the User Settings API?
What does console log return for distance?
I notice your code says unit, not units?
import { units } from "user-settings";
console.log(units.distance);
01-09-2018 16:53
01-09-2018 16:53
Are you importing units from the User Settings API?
What does console log return for distance?
I notice your code says unit, not units?
import { units } from "user-settings";
console.log(units.distance);