Can't get Number.format to work

I am trying to format numbers with a fixed number of digits before the decimal point.

My understanding is that:

( 3.1 ).format("%02.1f")

Should return a string "03.1". However it returns "3.1".

Any idea what I could be doing wrong?