Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including moment-to-reql with all npm packages installed. Try it out:

var momentToReql = require("moment-to-reql")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

moment-to-reql v1.1.1

A helper function to convert moment.js object to ReQL so that Timezone information can be preserved when passing data to RethinkDB.

moment-to-reql

GratiPay Downloads Version

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

Metadata

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free