moment-to-reql
v1.1.1
Published
A helper function to convert moment.js object to ReQL so that Timezone information can be preserved when passing data to RethinkDB.
Downloads
11
Maintainers
Readme
moment-to-reql
A helper function to convert moment.js object to ReQL so that Timezone information can be preserved when passing data to RethinkDB.
Installation
moment-to-reql
expects that you have already installed moment
and moment-timezone
.
npm instal --save-dev moment-to-reql
Usage
Returned value can be used in place of regular Date
, r.now()
and all other time/date objects in your ReQL queries:
import momentToReQL from 'moment-to-reql';
momentToReQL(moment.tz('10/10/2010 10:00', 'DD/MM/YYYY hh:mm', 'America/Los_Angeles');
// returns:
// {
// $reql_type$: 'TIME',
// epoch_time: 1286730000,
// timezone: '-07:00',
// }
License
ISC