Date FORMAT_SHORT/MEDIUM/LONG

The docs say...

FORMAT_SHORT = 0
Short formatting is a numerical representation of date/time.
Since:
1.0.0
FORMAT_MEDIUM = 1
Medium formatting is a mix of Numbers and Strings depending on what function is being called. If a String is used, it results in an abbreviated form of the time or date.
Since:
1.0.0
FORMAT_LONG = 2
Long formatting is a mix of Numbers and Strings depending on what function is being called. If a String is used, it results in the spelled out form of the time or date.
Since:
1.0.0

But where is it listed what the ACTUAL formatting is? for example I was hoping to use this for 'November'

var month_long = Calendar.info(now, Time.FORMAT_LONG).month;

But it returns

'Nov'
  • The documentation for Gregorian.Info is where you want to look. According to what I'm reading there, that is a bug. I've verified that it is indeed broken (documented behavior differs from actual) in the simulator and on several different devices (all using the latest release firmware).

    Travis
  • Hello Garmin,

    can this be fixed please? Ta
  • Sorry to hammer on about this but should this

    var day_long = Calendar.info(now, Time.FORMAT_LONG).day_of_week;

    Return 'Monday' etc?

    Ta
  • The documentation for both month and day_of_week says...

    Returns:
    (Object) — (FORMAT_SHORT => Number, FORMAT_MEDIUM => String (3 character abbreviation), FORMAT_LONG => String)


    So clearly FORMAT_MEDIUM should return a 3 character abbreviation, and FORMAT_LONG would return something other than that. What it actually returns isn't completely well defined, but I think it is safe to assume that it would be the full month/weekday name.

    While it doesn't really hurt, I don't really think you need to point this out. I'm confident that the guys at Garmin would see the original bug you mentioned, add testing for it and the other related fields, and then catch the second. At least that is how I'd expect it to work.
  • Your making an assumption but you're probably correct.

    However if they were that diligent with their testing we wouldn't have this bug in the first place.

    Don't shoot the messenger springs to mind.

    Sounds like you'd rather I not say a peep and let them discover what else is wrong. I'm clearly wasting my time helping point them in the right direction.
  • Sounds like you'd rather I not say a peep and let them discover what else is wrong. I'm clearly wasting my time helping point them in the right direction.

    What I think you should do and what you actually should do are often two very different things. Clearly there is a bug here, so bringing it up is the right thing IMO. I just don't feel there is the need to 'hammer it in' as you put it.
  • no hammering here. just reporting what i find.
  • Sorry to do some more hammering...

    Erm day is returned as

    Mon
    Tue
    Wed
    Thurs
    Fri
    Sat
    Sun

    Why is Thursday 5 chars? Weird.
  • I found it little strange too. But that's the way they decided to do it. But I don't see it as a big problem, you can crop it to length of 3 with substring if you want.

    Btw.
    http://www.grammarly.com/answers/questions/7944-days-of-the-week/

    More common abbreviations are:

    Mon, Tue, Wed, Thu, Fri, Sat, Sun

    or

    Mon. Tues. Wed. Thurs. Fri. Sat. Sun.

    Garmin made something between.
  • I too found it odd, and I do the substring thing as Petr mentioned if I want all day names to be the same length (I have a case where I even cut it to only 1 character).

    But "Thurs" does fit the definition of "FORMAT_MEDIUM"

    (from the SDK doc)
    "Medium formatting is a mix of Numbers and Strings depending on what function is being called. If a String is used, it results in an abbreviated form of the time or date."