Problem with Timer.fmt()

Hello

I am trying to get just the hour for current time using Timer.fmt(). However, the following code:

    let unixtime = Timer.now();
    let timestamp = Timer.fmt("%Y-%m-%d %H:%M:%S", localTIME.unixtime);
    print('++++', JSON.stringify({Weather: unixtime}));
    print('++++', JSON.stringify({Weather: timestamp}));

    let yearStr = Timer.fmt("%Y", unixtime);
    print('++++', JSON.stringify({Year: yearStr}));
    print("yearStr: ",yearStr);

Produes:

[Jun  4 18:08:07.046] ++++ {"Weather":1559671686.260598}
[Jun  4 18:08:07.078] ++++ {"Weather":"2019-06-04 18:08:06"}
[Jun  4 18:08:07.111] ++++ {"Year":"    "}
[Jun  4 18:08:07.111] yearStr:

Am I doing something wrong? Thanks.

No. You are not doing anything wrong.

There seems to be an issue related to the way mJS handles short strings.
I’ve filed a PR some time ago.

Then what do I have to do in my code? I can not get the year or hour from Timer.fmt() currently?

Find a workaround to get a result string longer than 6 characters and use slice

Thanks for your response.