Socket
Socket
Sign inDemoInstall

date-format-lite

Package Overview
Dependencies
0
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.7.2 to 0.7.3

40

index.js

@@ -79,2 +79,7 @@

Date[proto].tz = function(zone) {
this._z = zone
return this
}
Date.am = "AM"

@@ -94,32 +99,37 @@ Date.pm = "PM"

* // In Chrome Date.parse("01.02.2001") is Jan
* n = +date || Date.parse(date) || ""+date;
* num = +date || Date.parse(date) || ""+date;
*/
String[proto].date = Number[proto].date = function(format, zoneOut, zoneIn) {
var undef, m, year, month
, d = new Date()
, n = +this || "" + this
var undef, match, year, month
, date = new Date()
, num = +this || "" + this
if (isNaN(n)) {
if (m = n.match(dateRe)) {
if (isNaN(num)) {
if (match = num.match(dateRe)) {
// Big endian date, starting with the year, eg. 2011-01-31
// Middle endian date, starting with the month, eg. 01/31/2011
// Little endian date, starting with the day, eg. 31.01.2011
year = m[1] > 99 ? 1 : 3
year = match[1] > 99 ? 1 : 3
month = Date.middleEndian ? 4 - year : 2
d.setFullYear(m[year], m[month] - 1, m[6 - month - year])
date.setFullYear(match[year], match[month] - 1, match[6 - month - year])
}
// Time
m = n.match(timeRe) || [0, 0, 0]
d.setHours( m[6] && m[1] < 12 ? +m[1]+12 : m[5] && m[1] == 12 ? 0 : m[1], m[2], m[3]|0, (1000 * m[4])|0)
match = num.match(timeRe) || [0, 0, 0]
date.setHours(
match[6] && match[1] < 12 ? +match[1] + 12 :
match[5] && match[1] == 12 ? 0 : match[1],
match[2], match[3]|0, (1000 * match[4])|0
)
// Timezone
if (m[7]) {
zoneIn = (m[8]|0) + ((m[9]|0)/(m[8]<0?-60:60))
if (match[7]) {
zoneIn = (match[8]|0) + ((match[9]|0)/(match[8]<0?-60:60))
}
} else d.setTime( n < 4294967296 ? n * 1000 : n )
} else date.setTime( num < 4294967296 ? num * 1000 : num )
if (zoneIn != undef) d.setTime(d - (60 * zoneIn + d.getTimezoneOffset()) * 60000)
if (zoneIn != undef) date.setTime(date - (60 * zoneIn + date.getTimezoneOffset()) * 60000)
return format ? d.format(format, zoneOut) : d
return format ? date.format(format, zoneOut) : date
}

@@ -126,0 +136,0 @@

{
"name": "date-format-lite",
"version": "0.7.2",
"version": "0.7.3",
"stability": 2,

@@ -23,4 +23,3 @@ "author": "Lauri Rooden <lauri@rooden.ee>",

"build": "node node_modules/buildman/index.js --all",
"travis-test": "istanbul cover ./tests/run.js && (coveralls < coverage/lcov.info || exit 0)",
"test": "node tests/run.js"
"test": "node tests/index.js"
},

@@ -32,4 +31,4 @@ "repository": "git://github.com/litejs/date-format-lite.git",

"devDependencies": {
"buildman": "^0.2.27",
"testman": "^0.1.9"
"buildman": "0.2.31",
"testman": "0.3.1"
},

@@ -36,0 +35,0 @@ "buildman": {

@@ -90,4 +90,3 @@ [1]: https://secure.travis-ci.org/litejs/date-format-lite.png

// Add to estonian-lang.js
Date.dayNames = "P E T K N R L pühapäev esmaspäev teisipäev kolmapäev neljapäev reede laupäev".split(" ")
Date.monthNames = "Jaan Veeb Märts Apr Mai Juuni Juuli Aug Sept Okt Nov Dets jaanuar veebruar märts aprill mai juuni juuli august september oktoober november detsember".split(" ")
Date.names = "Jaan Veeb Märts Apr Mai Juuni Juuli Aug Sept Okt Nov Dets jaanuar veebruar märts aprill mai juuni juuli august september oktoober november detsember P E T K N R L pühapäev esmaspäev teisipäev kolmapäev neljapäev reede laupäev".split(" ")

@@ -94,0 +93,0 @@ // Change AM and PM

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc