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

edtf

Package Overview
Dependencies
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

edtf - npm Package Compare versions

Comparing version 2.0.0 to 2.0.1

src/format.js

2

index.js

@@ -8,2 +8,3 @@ 'use strict'

const { parse } = require('./src/parser')
const { format } = require('./src/format')

@@ -28,3 +29,4 @@ const { assign, keys } = Object

sample,
format,
types: keys(types)
})

2

package.json
{
"name": "edtf",
"version": "2.0.0",
"version": "2.0.1",
"description": "Extended Date Time Format (EDTF) / ISO 8601-2 Parser and Library",

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

@@ -13,3 +13,3 @@ # EDTF.js

### EDFT / ISO 8601-2
### EDTF / ISO 8601-2
EDTF.js fully implements [EDTF](http://www.loc.gov/standards/datetime)

@@ -16,0 +16,0 @@ levels 0, 1, and 2 as specified by WD 2016-02-16 of ISO 8601-2 with

@@ -8,5 +8,7 @@ 'use strict'

const mixin = require('./mixin')
const { format } = require('./format')
const { abs } = Math
const { isArray } = Array
const { defineProperty: prop } = Object

@@ -88,5 +90,8 @@ const P = new WeakMap()

this.unspecified = unspecified
prop(this, 'format', {
value: format.bind(null, this)
})
}
set precision(value) {

@@ -253,2 +258,6 @@ P.set(this, (value > 3) ? 0 : Number(value))

localize(...args) {
return this.format(...args).format(this)
}
static pad(number, idx = 0) { // idx 0 = year, 1 = month, ...

@@ -255,0 +264,0 @@ if (!idx) {

@@ -59,3 +59,3 @@ // Generated automatically by nearley

{"name": "time$string$1", "symbols": [{"literal":"2"}, {"literal":"4"}, {"literal":":"}, {"literal":"0"}, {"literal":"0"}, {"literal":":"}, {"literal":"0"}, {"literal":"0"}], "postprocess": function joiner(d) {return d.join('');}},
{"name": "time", "symbols": ["time$string$1"], "postprocess": () => [24, 00, 00]},
{"name": "time", "symbols": ["time$string$1"], "postprocess": () => [24, 0, 0]},
{"name": "hours", "symbols": ["d00_23"], "postprocess": num},

@@ -62,0 +62,0 @@ {"name": "minutes", "symbols": ["d00_59"], "postprocess": num},

@@ -45,2 +45,6 @@ 'use strict'

toLocaleString(...args) {
return this.localize(...args)
}
inspect() {

@@ -47,0 +51,0 @@ return this.toEDTF()

@@ -509,2 +509,13 @@ 'use strict'

})
describe('.localize', () => {
it('YYYY', () =>
expect(new Date([2014]).localize('en-US')).to.eql('2014'))
it('YYYY-MM', () =>
expect(new Date([2014, 3]).localize('en-US')).to.eql('4/2014'))
it('YYYY-MM-DD', () =>
expect(new Date([2014, 3, 1]).localize('en-US')).to.eql('4/1/2014'))
})
})

@@ -294,2 +294,6 @@ 'use strict'

it('*/2016', () =>
expect(p('*/2016'))
.to.be.an.interval.through([2016]).at.level(1))
it('YYYY-MM/*', () =>

@@ -299,5 +303,13 @@ expect(p('2016-05/*'))

it('YYYY-MM-DD/*', () =>
expect(p('2004-06-01/*'))
.to.be.an.interval.from([2004, 5, 1]).at.level(1))
it('/YYYY-MM', () =>
expect(p('/2016-05'))
.to.be.an.interval.through([2016, 4]).at.level(1))
it('YYYY-MM-DD/', () =>
expect(p('2016-05-31/*'))
.to.be.an.interval.from([2016, 4, 31]).at.level(1))
})

@@ -304,0 +316,0 @@

Sorry, the diff of this file is not supported yet

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