@qrohlf/smart-date
Advanced tools
Comparing version 1.1.0 to 1.1.1
@@ -54,5 +54,3 @@ 'use strict'; | ||
{ | ||
var _start = moment().subtract(1, 'week'); | ||
var _end = moment().add(1, 'week'); | ||
return relative && m.isBetween(_start, _end); | ||
return relative; | ||
} | ||
@@ -59,0 +57,0 @@ default: |
@@ -45,5 +45,3 @@ const moment = require('moment') | ||
case 'boolean': { | ||
const start = moment().subtract(1, 'week') | ||
const end = moment().add(1, 'week') | ||
return relative && m.isBetween(start, end) | ||
return relative | ||
} | ||
@@ -50,0 +48,0 @@ default: { |
{ | ||
"name": "@qrohlf/smart-date", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "Takes date objects. Returns sane human-readable strings.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
11
tests.js
@@ -62,5 +62,5 @@ /* eslint-env mocha */ | ||
describe('relative option', () => { | ||
it('defaults to 1 week for {relative: true}', () => { | ||
expect(formatSingleDate('2016-06-22', {relative: true})).to.eql('June 22nd') | ||
expect(formatSingleDate('2016-06-23', {relative: true})).to.eql('June 23rd') | ||
it('displays all dates as relative for {relative: true}', () => { | ||
expect(formatSingleDate('2014-05-30', {relative: true})).to.eql('2 years ago') | ||
expect(formatSingleDate('2015-05-30', {relative: true})).to.eql('a year ago') | ||
expect(formatSingleDate('2016-06-24', {relative: true})).to.eql('6 days ago') | ||
@@ -75,6 +75,3 @@ expect(formatSingleDate('2016-06-25', {relative: true})).to.eql('5 days ago') | ||
expect(formatSingleDate('2016-07-03', {relative: true})).to.eql('in 3 days') | ||
expect(formatSingleDate('2016-07-04', {relative: true})).to.eql('in 4 days') | ||
expect(formatSingleDate('2016-07-05', {relative: true})).to.eql('in 5 days') | ||
expect(formatSingleDate('2016-07-06', {relative: true})).to.eql('in 6 days') | ||
expect(formatSingleDate('2016-07-07', {relative: true})).to.eql('July 7th') | ||
expect(formatSingleDate('2019-07-03', {relative: true})).to.eql('in 3 years') | ||
}) | ||
@@ -81,0 +78,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
20266
420