how does addMonthsLocalTime() work?

prasanna11
Giga Guru

Does this function calculates result based upon number of days/ just plays with the months part ? I see ambiguity as below..

gs.print(gs.now());

var gd = new GlideDateTime();

gd.setValue(gs.now());

gd.addMonthsLocalTime(parseInt(9));

gs.print(gd.getValue());

Output:

*** Script: 2017-01-06

*** Script: 2017-10-05 23:00:00

Whereas replacing number of months with 10 produces below result.

*** Script: 2017-01-06

*** Script: 2017-11-06 00:00:00

Why the one hour ambiguity when its 9 months?