Ticket Created
over 3 years ago

WERETECH-12628

LocalMoment is wrong

The documentation fails to provide an initializing Constructor and the example is wrong.

a) It requires (where, when) not (when, where).

b) it doesn't take a Gregorian.moment as the when argument.

This, from the documentation fails:

if (Gregorian has :localMoment){
		var options = {
			:year   => 2018,
			:month  => 2,
			:day    => 24,
			:hour   => 0,
			:min    => 12 
		};
		var when = Gregorian.moment(options);
		
		var where = new Position.Location({
			:latitude  =>  38.85391,
			:longitude => -94.79630,
			:format    => :degrees,
		});

		var local = Gregorian.localMoment(when, where);
		var info = Gregorian.info(local, Time.FORMAT_SHORT);
	}

This works

if (Gregorian has :localMoment){
		var options = {
			:year   => 2018,
			:month  => 2,
			:day    => 24,
			:hour   => 0,
			:min    => 12 
		};
		var when = Gregorian.moment(options);
		
		var where = new Position.Location({
			:latitude  =>  38.85391,
			:longitude => -94.79630,
			:format    => :degrees,
		});

		var local = Gregorian.localMoment(where, when.value());
		var info = Gregorian.info(local, Time.FORMAT_SHORT);
	}

- note (where, when), not (when, where) , and a number not a moment.

Parents
  • So, as far as I see, when I build the project with SDK >= 4.1.6, localMoment requires a Time.Gregorian.moment as a second argument.

    However, given the exception mentioned above, when the app is running on the watch, localMoment requires a Number (when.value()).

    I suspect, either I am configuring something wrong, or the most recent SDK doesn't accurately simulate the watch firmware (at least for my fenix-6).

    Only workaround I found so far is to build the project with SDK 4.1.5, where localMoment still requires a Number as a second argument.

    This way both the simulator and the watch are happy using a Number and I can build the project successfully.

Comment
  • So, as far as I see, when I build the project with SDK >= 4.1.6, localMoment requires a Time.Gregorian.moment as a second argument.

    However, given the exception mentioned above, when the app is running on the watch, localMoment requires a Number (when.value()).

    I suspect, either I am configuring something wrong, or the most recent SDK doesn't accurately simulate the watch firmware (at least for my fenix-6).

    Only workaround I found so far is to build the project with SDK 4.1.5, where localMoment still requires a Number as a second argument.

    This way both the simulator and the watch are happy using a Number and I can build the project successfully.

Children
No Data