moved similar momentjs calls into a function