Sha256: 21d2c462bd4a4fc6867495be859b4a789dc05549f0e05ebd5f6a836076e16982
Contents?: true
Size: 518 Bytes
Versions: 11
Compression:
Stored size: 518 Bytes
Contents
const mongoose = require('mongoose'); const cql = require('cql-execution'); function DateTime(key, options) { mongoose.SchemaType.call(this, key, options, 'DateTime'); } DateTime.prototype = Object.create(mongoose.SchemaType.prototype); DateTime.prototype.cast = (dateTime) => { if (!Date.parse(dateTime)) { throw new Error(`DateTime: ${dateTime} is not a valid DateTime`); } return cql.DateTime.fromDate(new Date(dateTime), 0); }; mongoose.Schema.Types.DateTime = DateTime; module.exports = DateTime;
Version data entries
11 entries across 11 versions & 1 rubygems