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
  • More than a year passed by and no reply.
    I'm trying to use `Gregorian.localMoment` with the SDK 6.4.2 and the simulator.
    When using

    Gregorian.localMoment(where, when.value());

    I get:

    Invalid '$.Toybox.Lang.Number' passed as parameter 2 of type '$.Toybox.Time.Moment'.

    But if I use

    Gregorian.localMoment(where, when);

    The app crashes with

    Exception: UnexpectedTypeException: Expected an object of type Time.Moment

Comment
  • More than a year passed by and no reply.
    I'm trying to use `Gregorian.localMoment` with the SDK 6.4.2 and the simulator.
    When using

    Gregorian.localMoment(where, when.value());

    I get:

    Invalid '$.Toybox.Lang.Number' passed as parameter 2 of type '$.Toybox.Time.Moment'.

    But if I use

    Gregorian.localMoment(where, when);

    The app crashes with

    Exception: UnexpectedTypeException: Expected an object of type Time.Moment

Children
No Data