# mongoose-timestamps-moment

> ```bash npm install -s mongoose-timestamps-moment moment ```

Latest version **1.0.0** (published 2018-03-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install mongoose-timestamps-moment
pnpm add mongoose-timestamps-moment
yarn add mongoose-timestamps-moment
bun add mongoose-timestamps-moment
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2018-03-20 |
| First published | 2018-03-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 9.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Nhat Phan |
| Maintainers | najs |

## Links

- npm: https://www.npmjs.com/package/mongoose-timestamps-moment
- Repository: https://github.com/najs-framework/mongoose-timestamps-moment
- Homepage: https://github.com/najs-framework/mongoose-timestamps-moment#readme
- Issues: https://github.com/najs-framework/mongoose-timestamps-moment/issues
- npm.io page: https://npm.io/package/mongoose-timestamps-moment

## Recent versions

- 1.0.0 (latest) — 2018-03-20

## README

### Installation

```bash
npm install -s mongoose-timestamps-moment moment
```

### Usage

Replacing `setupTimestamp` in mongoose Schema.prototype

```
Schema.prototype.setupTimestamp = require('mongoose-timestamps-moment').setupTimestamp
```

After that you can set custom `now` value in unit test

```javascript
const Moment = require('moment')

describe('Custom "now" value', function() {
  it('can create in a specific date', async function() {
    const now = new Date(1988, 4, 16)
    Moment.now = () => now

    const model = new Model()
    await model.save()
    expect(model.createdAt).toEqual(now)
    expect(model.updatedAt).toEqual(now)
  })
})
```

### License

MIT @ Nhat Phan

---
_Source: https://npm.io/package/mongoose-timestamps-moment · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
