Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
date-utils-2020
Advanced tools
date utils 2020, format(date: Date, formatter: string)/toDate(a?: any)...
date utils 2020, format(date: Date, formatter: string)/toDate(a?: any)...
npm i -S date-utils-2020
# or
yarn add date-utils-2020
import { formatDate, toDate } from 'date-utils-2020'
const date = toDate('2020-12-04')
console.log(date)
// Fri Dec 04 2020 09:00:00 GMT+0900 (Japan Standard Time)
const result = formatDate('2020-12-04', 'yyyy/MM/dd W')
console.log(result)
// 2020/12/04 五
// node.js
const { formatDate } = require('date-utils-2020')
const result = formatDate(new Date(), 'yyyy/MM/dd hh:mm:ss')
console.log(result)
// 2020/12/05 16:07:43
import { formatDate } from 'date-utils-2020'
constole.log(formatDate(new Date(), 'yyyy/MM/dd hh:mm:ss'))
Method | Parameters | Description |
---|---|---|
formatDate | (date: any, format: string, langPackage?: ILangPackage) | return string |
toDate | (s: any) | return Date or null |
isNumberLike | (n: any) | return boolean true or false |
toTwoDigits | (n: number) | return string |
Date Formats
|format|meaning|Example|
|:--|:--|:--|:--|
|yyyy/yy|year|2021
/21
|
|MM/M|month|01
/1
|
|dd/d|day|01
/1
|
|hh/h|hour|01
/1
|
|mm/m|minute|01
/1
|
|ss/s|second|01
/1
|
|w|week|[0, 1, 2, 3, 4, 5, 6]
|
|W|week|['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']
|
|a|am/pm|am
|
|A|AM/PM|AM
|
Props | Type | Description |
---|---|---|
weeks | string[] | Example: ['日曜日', '月曜日', '火曜日', '水曜日', '木曜日', '金曜日', '土曜日'] , Default: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'] |
const langPackage = {
// ['日', '一', '二', '三', '四', '五', '六']
weeks: ['日曜日', '月曜日', '火曜日', '水曜日', '木曜日', '金曜日', '土曜日']
}
formatDate(new Date(), 'yyyy/MM/dd(W) hh:mm:ss', langPackage)
// 2020/12/05(土曜日) 12:22:52
FAQs
date utils 2020, format(date: Date, formatter: string)/toDate(a?: any)...
We found that date-utils-2020 demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.