# quering-date

> Parse date values to return a interval, to be used in queries with dates.

Latest version **1.0.2** (published 2020-03-16) · MIT license · 0 weekly downloads

## Install

```sh
npm install quering-date
pnpm add quering-date
yarn add quering-date
bun add quering-date
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2020-03-16 |
| First published | 2020-03-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Daniel A. R. Farina |
| Maintainers | danielfarina |
| Keywords | parse, query, date, interval |

## Links

- npm: https://www.npmjs.com/package/quering-date
- Repository: https://github.com/danielbom/quering-date
- Homepage: https://github.com/danielbom/quering-date#readme
- Issues: https://github.com/danielbom/quering-date/issues
- npm.io page: https://npm.io/package/quering-date

## Alternatives

- [babylon](https://npm.io/package/babylon.md) — 5.1M weekly downloads
- [csscolorparser](https://npm.io/package/csscolorparser.md) — 3.7M weekly downloads
- [expr-eval-fork](https://npm.io/package/expr-eval-fork.md) — 1.5M weekly downloads
- [@leeoniya/ufuzzy](https://npm.io/package/@leeoniya/ufuzzy.md) — 247.7K weekly downloads
- [xml-parser](https://npm.io/package/xml-parser.md) — 78.4K weekly downloads

## Recent versions

- 1.0.2 (latest) — 2020-03-16
- 1.0.1 — 2020-03-07
- 1.0.0 — 2020-03-07

## README

# Quering date

Parse date values to return a interval, to be used in queries with dates.

# Basic usage

```javascript
const MyModel = require("path/to/model/MyModel");
const processQueryDate = require("../../lib/process-query-date");

async function index(req, res) {
  try {
    const aggregation = [];

    if (req.query._date || req.query._month || req.query._year) {
      const { start, end } = processQueryDate(req.query);
      aggregation.push({
        date: {
          $gte: start,
          $lte: end
        }
      });
    }

    const entities = await MyModel.aggregate(aggregation);

    return res.status(200).json(entities);
  } catch (e) {
    return res.status(500).json({
      error: e.toString(),
      message: e.message,
      stack: e.stack
    });
  }
}
```

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