getSunrise() Function

I'm playing around with Sunrise and Sunset in a datafield for Edge devices.

I coded some lines, but I get an error in line 12 :

infoSunR = Time.Gregorian.Info( sunRise, Time.FORMAT_LONG );
Error: Unhandled Exception
Exception: UnexpectedTypeException: Expected Method, given Class definition

I check for the values curpos, today and sunRise: all 3 deliever an object.

I assume variable "sunRise" as a time.moment.

Why throws Time.Gregorian.Info( sunRise, Time.FORMAT_LONG ) an error?

        // SUNEVENTS    
        if ( Toybox has :Weather ) {
            //var curpos = info.currentLocation;
            var curpos = Weather.getCurrentConditions().observationLocationPosition; 
            var today = Weather.getCurrentConditions().observationTime;
            var sunRise = null;
            var infoSunR = null;
            if ( curpos != null and today != null )  {
                sunRise = Weather.getSunrise(curpos, today);
                //System.println( curpos + "    " + today + "     " + sunRise);
                if ( sunRise != null ) {
                    infoSunR = Time.Gregorian.Info( sunRise, Time.FORMAT_LONG );
                    System.println( "Hour: " + infoSunR.hour );
                }
            }
        }

Top Replies

All Replies