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

lunar-lite

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lunar-lite - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

2

lib/convertor.d.ts
import { LunarDate, SolarDate } from "./types";
/**
* 将日期字符串 YYYY-MM-DD 或者一个 Date 对象分割为 [YYYY, M - 1, D]
* 将日期字符串 YYYY-MM-DD 或者一个 Date 对象分割为 [YYYY, M, D, H, m, s]
* 当参数为字符串时分割符可以是 `-` `.` 或者 `/`

@@ -5,0 +5,0 @@ *

@@ -8,3 +8,3 @@ "use strict";

/**
* 将日期字符串 YYYY-MM-DD 或者一个 Date 对象分割为 [YYYY, M - 1, D]
* 将日期字符串 YYYY-MM-DD 或者一个 Date 对象分割为 [YYYY, M, D, H, m, s]
* 当参数为字符串时分割符可以是 `-` `.` 或者 `/`

@@ -19,9 +19,16 @@ *

if (date instanceof Date) {
return [date.getFullYear(), date.getMonth() + 1, date.getDate()];
return [
date.getFullYear(),
date.getMonth() + 1,
date.getDate(),
date.getHours(),
date.getMinutes(),
date.getSeconds(),
];
}
var result = date
.split(/[. -/]/)
.filter(function (word) { return word !== ""; })
.map(function (word) { return +word.trim(); });
return result;
return date
.split(/[ ]+/)
.map(function (item) { return item.split(/[-:/.]/); })
.reduce(function (prev, next) { return prev.concat(next); }, [])
.map(function (item) { return +item; });
};

@@ -28,0 +35,0 @@ exports.normalizeDateStr = normalizeDateStr;

{
"name": "lunar-lite",
"version": "0.0.1",
"version": "0.0.2",
"description": "精简版的农历和阳历日期转换库。",

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

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