A quick port from https://github.com/adamalbrecht/ngQuickDate