As the thread title states this solution applies only to version 1.x.
The calendar control differs a lot in version 2.x so it is normal (or I'd rather say expected) the sample code fails to compile.