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

date-utils-2020

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

date-utils-2020 - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

.babelrc

31

package.json
{
"name": "date-utils-2020",
"version": "0.0.1",
"version": "0.0.2",
"description": "date utils 2020, format(date: Date, formatter: string)/toDate(a?: any)...",
"main": "src/index.js",
"main": "dist/date-utils-2020.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "node test/index.js",
"dev": "webpack serve",
"build": "webpack --mode production"
},
"types": "types/index.d.ts",
"repository": {

@@ -18,3 +21,3 @@ "type": "git",

"toDate",
"format"
"formatDate"
],

@@ -26,3 +29,21 @@ "author": "Capricorncd",

},
"homepage": "https://github.com/capricorncd/date-utils-2020#readme"
"homepage": "https://github.com/capricorncd/date-utils-2020#readme",
"devDependencies": {
"@babel/core": "^7.12.9",
"@babel/preset-env": "^7.12.7",
"babel-loader": "^8.2.2",
"clean-webpack-plugin": "^3.0.0",
"eslint": "^7.14.0",
"eslint-config-standard": "^16.0.2",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-standard": "^5.0.0",
"eslint-webpack-plugin": "^2.4.1",
"html-webpack-plugin": "^4.5.0",
"webpack": "^5.9.0",
"webpack-cli": "^4.2.0",
"webpack-dev-server": "^3.11.0",
"webpack-merge": "^5.4.0"
}
}

@@ -35,3 +35,3 @@ # date-utils-2020

|:--|:--|:--|
|formatDate|(date: any, fmt: string, languagePack?: object)|return `string`|
|formatDate|(date: any, fmt: string, langPackage?: langPackage)|return `string`|
|toDate|(s: any)|return `Date` or `null`|

@@ -42,2 +42,15 @@ |isNumberLike|(n: any)| return Boolean `true` or `false`|

#### langPackage
|Props|Type|Description|
|:--|:--|:--|
|weeks|`string[]`|Example: `['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']`, Default: `['日', '一', '二', '三', '四', '五', '六']`|
```javascript
const langPackage = {
weeks: ['日曜日', '月曜日', '火曜日', '水曜日', '木曜日', '金曜日', '土曜日']
}
formatDate(new Date(), 'yyyy/MM/dd(W) hh:mm:ss', langPackage)
// 2020/12/05(土曜日) 12:22:52
```

2

src/index.js

@@ -17,3 +17,3 @@ /**

* @param langPackage
* @returns {number|*}
* @returns {string}
*/

@@ -20,0 +20,0 @@ function formatDate(srcDate, fmt, langPackage) {

@@ -28,3 +28,3 @@ /**

* @param n
* @returns {*}
* @returns {string}
*/

@@ -31,0 +31,0 @@ export function toTwoDigits(n) {

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