Use gregorian calendar to encode dates

Fixes #15