The Calculate Age article isn't working.

The article 

https://developer.kintone.io/hc/en-us/articles/115005619348-Calculate-with-Local-Date

The JS code worked for a while, until suddenly it stopped. I am not sure if its because of a change in the way that the system pulls dates and calculations. But my colleague and I tried every basic debug step to figure out the issue. But to no avail.

When you put in a date: Example 07-02-2000, you get the result of -1979.

Now it used to work but for some reason now it isn’t. Could someone help?

Hello Tim!

I’m still looking into it, but when it gets to the date format conversion part of the today’s date:

vartoday=newDate();
var _today = parseInt(today.getFullYear() + affixZero(today.getMonth() + 1) + affixZero(today.getDate()));

it looks like it’s giving a weird value so the conversion is probably not working correctly.
It might be due to when getting today’s date at

vartoday=newDate();

the date is not in the YYYY-MM-DD format so that might be the reason.
You might need figure out a way to get the date in that format which might solve the problem.

I hope that helps.

Tim, Yuzo

Apologies, there were some bugs in the code related to calculations of numbers and strings.

The document has now been updated with working code.

For reference, here are the code changes:

https://gist.github.com/kintonedevnet/128251d1ea901578d4f8a6d08ae904e2/revisions