It's because you must have the data type for that cell set to "automatic" or "duration", and Google Sheets will guess that "3:30:00" is a type of date/time for automatic, and for duration it converts it to date/time for passing to your function. It lets you keep it in your format (#:##:##), but when you pass it to your custom formula, Sheets first converts it to a Javascript Date object, which your function then returns, and sheets automatically displays as a regular date (12/30/1899
). See Google's warning about Date conversions with custom functions here.
The easiest solution is to just explicitly set your input format to "plain text" using the format selection dropdown, and then in your custom function code, you can parse it as you see fit.
For example, I used this StackOverflow answer to write your custom function:
function DURATION_DECIMALS(input){
// https://stackoverflow.com/a/22820471/11447682
var arr = input.split(':');
var dec = parseInt((arr[1]/6)*10, 10);
return parseFloat(parseInt(arr[0], 10) + '.' + (dec<10?'0':'') + dec);
}
And here it is working with format set to plain text: