Implemented full compiler of date and datetime types, which is 30-80% faster than regexp based approach.
Minor tweaks and shuffles.