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

@shopify/dates

Package Overview
Dependencies
Maintainers
13
Versions
112
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@shopify/dates - npm Package Compare versions

Comparing version 0.3.6 to 0.4.0

dist/src/is-less-than-one-week-away.d.ts

6

CHANGELOG.md

@@ -8,4 +8,8 @@ # Changelog

<!-- ## [Unreleased] -->
## [0.4.0] - 2020-06-04
### Added
- Added `isLessThanOneWeekAway` and `isLessThanOneYearAgo` functions [[#1438](https://github.com/Shopify/quilt/pull/1438)]
## [0.3.4] - 2020-03-13

@@ -12,0 +16,0 @@

@@ -10,3 +10,5 @@ export * from './apply-time-zone-offset';

export * from './is-less-than-one-week-ago';
export * from './is-less-than-one-week-away';
export * from './is-less-than-one-year-ago';
export * from './is-less-than-one-year-away';
export * from './is-same-day';

@@ -13,0 +15,0 @@ export * from './is-same-month';

@@ -13,3 +13,5 @@ "use strict";

tslib_1.__exportStar(require("./is-less-than-one-week-ago"), exports);
tslib_1.__exportStar(require("./is-less-than-one-week-away"), exports);
tslib_1.__exportStar(require("./is-less-than-one-year-ago"), exports);
tslib_1.__exportStar(require("./is-less-than-one-year-away"), exports);
tslib_1.__exportStar(require("./is-same-day"), exports);

@@ -16,0 +18,0 @@ tslib_1.__exportStar(require("./is-same-month"), exports);

2

package.json
{
"name": "@shopify/dates",
"version": "0.3.6",
"version": "0.4.0",
"license": "MIT",

@@ -5,0 +5,0 @@ "description": "Lightweight date operations library.",

@@ -154,2 +154,16 @@ # `@shopify/dates`

### `isLessThanOneWeekAway`
Takes in a date object and an optional "now" date object (that defaults to `new Date()`). Returns a boolean indicating whether or not the date is less than one week after the "now" date.
```ts
import {isLessThanOneWeekAway} from '@shopify/dates';
const moreThanOneWeekAway = new Date(Date.now() + 8 * TimeUnit.Day);
const lessThanOneWeekAway = new Date(Date.now() + 6 * TimeUnit.Day);
isLessThanOneWeekAway(moreThanOneWeekAway); // false
isLessThanOneWeekAway(lessThanOneWeekAway); // true
```
### `isLessThanOneYearAgo`

@@ -169,2 +183,16 @@

### `isLessThanOneYearAway`
Takes in a date object and an optional "now" date object (that defaults to `new Date()`). Returns a boolean indicating whether or not the date is less than one year after the "now" date.
```ts
import {isLessThanOneYearAway} from '@shopify/dates';
const moreThanOneYearAway = new Date(Date.now() + 53 * TimeUnit.Week);
const lessThanOneYearAway = new Date(Date.now() + 51 * TimeUnit.Week);
isLessThanOneYearAway(moreThanOneYearAway); // false
isLessThanOneYearAway(lessThanOneYearAway); // true
```
### `isSameDay`

@@ -171,0 +199,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