UNPKG

e-lado

Version:

[![CircleCI](https://circleci.com/gh/sharetribe/sharetribe/tree/master.svg?style=svg)](https://circleci.com/gh/sharetribe/sharetribe/tree/master) [![Dependency Status](https://gemnasium.com/sharetribe/sharetribe.png)](https://gemnasium.com/sharetribe/shar

30 lines (27 loc) 550 B
/* Common utilities for handling JavaScript native Date objects */ /* Takes a UTC midnight date and converts it to local midnight date */ export const fromMidnightUTCDate = (d) => new Date( d.getUTCFullYear(), d.getUTCMonth(), d.getUTCDate(), 0, 0, 0, 0 ); /* Takes a JavaScript Date in local timezone and converts it to UTC midnight date */ export const toMidnightUTCDate = (d) => new Date( Date.UTC( d.getFullYear(), d.getMonth(), d.getDate(), 0, 0, 0, 0 ));