@michaelray/mongoose-timezone
TypeScript icon, indicating that this package has built-in type declarations

0.0.10-alpha • Public • Published

mongoose-timezone

一个mongoose插件,用于规范存储的日期时区。默认情况下,mongo日期以UTC格式存储,如果服务器存放在其它时区,则显示会有差别。该插件用于渲染服务器所在时区的时间。

A mongoose plugin used to standardize the stored date and time zone. By default, mongo dates are stored in UTC format, but if the server is stored in another time zone, the display may differ. This plugin is used to render the time zone of the server.

Install

npm install @michaelray/mongoose-timezone --save

Usage

import mongoose from "mongoose";
// @ts-ignore
import {timeZone}  from "@michaelray/mongoose-timezone";

// 全局插件
mongoose.plugin(timeZone);
// @ts-ignore
import { baseSchema } from "@michaelray/mongoose-timezone/baseSchema";
const schemaData =  new Schema({
	date: Date,
	subDocument: {
		subDate: {
			type: Date,
		},
	},
  ...baseSchema // add like this
})

Readme

Keywords

none

Package Sidebar

Install

npm i @michaelray/mongoose-timezone

Weekly Downloads

60

Version

0.0.10-alpha

License

BSD-3-Clause

Unpacked Size

3.92 kB

Total Files

6

Last publish

Collaborators

  • michaelray1982