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

easydate

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

easydate - npm Package Compare versions

Comparing version 1.3.0 to 1.4.0

39

easydate.js

@@ -12,14 +12,8 @@ 'use strict'

function tidyNumber (value) {
if (value < 10) {
return '0' + String(value)
}
if (value < 10) return '0' + String(value)
return String(value)
}
function tidyMs (value) {
if (value < 10) {
return '00' + String(value)
}
if (value < 100) {
return '0' + String(value)
}
if (value < 10) return '00' + String(value)
if (value < 100) return '0' + String(value)
return String(value)

@@ -35,19 +29,16 @@ }

}
var tz = date.toUTCString().split(' ')
return pattern
.replace('d', tidyNumber(date.getUTCDate()))
.replace('M', tidyNumber(date.getUTCMonth() + 1))
.replace('y', String(date.getUTCFullYear()).substring(2, 4))
.replace('Y', String(date.getUTCFullYear()))
.replace('h', tidyNumber(date.getHours()))
.replace('m', tidyNumber(date.getMinutes()))
.replace('s', tidyNumber(date.getSeconds()))
.replace('l', tidyMs(date.getMilliseconds()))
.replace('d', tidyNumber(date.getUTCDate()))
.replace('M', tidyNumber(date.getUTCMonth() + 1))
.replace('y', String(date.getUTCFullYear()).substring(2, 4))
.replace('Y', String(date.getUTCFullYear()))
.replace('h', tidyNumber(date.getHours()))
.replace('m', tidyNumber(date.getMinutes()))
.replace('s', tidyNumber(date.getSeconds()))
.replace('l', tidyMs(date.getMilliseconds()))
.replace('z', tz[tz.length - 1])
}
if (typeof module === 'object') {
module.exports = easydate
}
if (typeof window === 'object') {
window.easydate = easydate
}
if (typeof module === 'object') module.exports = easydate
if (typeof window === 'object') window.easydate = easydate

@@ -9,3 +9,3 @@ {

],
"version": "1.3.0",
"version": "1.4.0",
"description": "get date and/or time by pattern",

@@ -12,0 +12,0 @@ "keywords": [

@@ -30,2 +30,4 @@ 'use strict'

assert.notEqual(easydate('z'), null)
// invalid string (aside from an empty string) will throw

@@ -32,0 +34,0 @@ try {

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