New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

moment-lite

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

moment-lite

一直很喜欢 `moment.js`,但是它有时候太臃肿了(好比语言包问题),而且不够函数式(`moment().add(1, 'days')`的副作用...),所以我就写了个非常轻量级的 `moment-lite.js`。

  • 0.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

moment-lite.js

一直很喜欢 moment.js,但是它有时候太臃肿了(好比语言包问题),而且不够函数式(moment().add(1, 'days')的副作用...),所以我就写了个非常轻量级的 moment-lite.js

后来同事告诉说已经有一个很好的 moment.js 替代品了:https://date-fns.org/。Well...也没有关系,就当自己练手吧。我设计的 API 跟它们都不太一样。

目标:

  • 好用的 API
  • 无副作用
  • 轻量级

Info

Usage

import moment from 'moment-lite';

const now = moment();
console.log(now.format('YYYY-MM-DD HH:mm:ss'));

APIs

const now = moment();

/**
 * moment.prototype.format
 * 格式化日期
 */
const str = now.format('YYYY-MM-DD');

/**
 * moment.prototype.add(num, unit)
 * 增加日期
 */
const oneMonthLater = now.add(30, 'days');

FAQs

Package last updated on 28 Apr 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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