Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mongoose-dateonly

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mongoose-dateonly - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

2

package.json
{
"name": "mongoose-dateonly",
"version": "1.0.1",
"version": "1.0.2",
"description": "Provides mongoose support for dates only, typically to avoid timezone issues.",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -17,8 +17,8 @@ ## About ##

var p1 = new Person({ birthday: '4/7/1990' });
var p2 = new Person({ birthday: new Date('4/7/1990') });
var p3 = new Person({ birthday: new DateOnly('4/7/1999') });
var p1 = new Person({ birthday: '4/7/1995' });
var p2 = new Person({ birthday: new Date('4/7/1995') });
var p3 = new Person({ birthday: new DateOnly('4/7/1995') });
```
In Mongo, the values above would all be stored as `19990307`. Because they're not stored as conventional `Date` objects, they are not subject to time zone shifts. In other words, no matter what time zone a user is in, this date will always be 4/7/1990.
In Mongo, the values above would all be stored as `19950307`. Because they're not stored as conventional `Date` objects, they are not subject to time zone shifts. In other words, no matter what time zone a user is in, this date will always be 4/7/1995.

@@ -28,3 +28,3 @@ The `DateOnly` data type supports all of the query conditions you would expect it to:

```javascript
Person.find({ birthday: '4/7/1990' });
Person.find({ birthday: '4/7/1995' });
Person.find({ birthday: { $lt: Date.now() } });

@@ -31,0 +31,0 @@ Person.find({ birthday: { $in: [ '1/1/2000', new Date('1/1/2010'), new DateOnly()]}})

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc