New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@shopify/dates

Package Overview
Dependencies
Maintainers
19
Versions
115
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 2.0.0-wp5-beta.1 to 2.0.0

build/cjs/format.js

55

build/cjs/_virtual/_rollupPluginBabelHelpers.js

@@ -5,55 +5,2 @@ 'use strict';

function ownKeys(object, enumerableOnly) {
var keys = Object.keys(object);
if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(object);
if (enumerableOnly) {
symbols = symbols.filter(function (sym) {
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
});
}
keys.push.apply(keys, symbols);
}
return keys;
}
function _objectSpread2(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i] != null ? arguments[i] : {};
if (i % 2) {
ownKeys(Object(source), true).forEach(function (key) {
_defineProperty(target, key, source[key]);
});
} else if (Object.getOwnPropertyDescriptors) {
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
} else {
ownKeys(Object(source)).forEach(function (key) {
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
});
}
}
return target;
}
function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) {

@@ -89,3 +36,1 @@ var desc = {};

exports.applyDecoratedDescriptor = _applyDecoratedDescriptor;
exports.defineProperty = _defineProperty;
exports.objectSpread2 = _objectSpread2;

@@ -7,2 +7,3 @@ 'use strict';

var index = require('./constants/index.js');
var getDateDiff = require('./get-date-diff.js');
var getDateTimeParts = require('./get-date-time-parts.js');

@@ -18,2 +19,3 @@ var getTimeZoneOffset = require('./get-time-zone-offset.js');

var isLessThanOneYearAway = require('./is-less-than-one-year-away.js');
var isPastDate = require('./is-past-date.js');
var isSameDay = require('./is-same-day.js');

@@ -30,2 +32,3 @@ var isSameMonth = require('./is-same-month.js');

var mapDeprecatedTimezones = require('./map-deprecated-timezones.js');
var format = require('./format.js');
var formatDate = require('./utilities/formatDate.js');

@@ -41,2 +44,3 @@ var timezone = require('./utilities/timezone.js');

});
exports.getDateDiff = getDateDiff.getDateDiff;
exports.getDateTimeParts = getDateTimeParts.getDateTimeParts;

@@ -52,2 +56,3 @@ exports.getTimeZoneOffset = getTimeZoneOffset.getTimeZoneOffset;

exports.isLessThanOneYearAway = isLessThanOneYearAway.isLessThanOneYearAway;
exports.isPastDate = isPastDate.isPastDate;
exports.isSameDay = isSameDay.isSameDay;

@@ -64,4 +69,5 @@ exports.isSameMonth = isSameMonth.isSameMonth;

exports.mapDeprecatedTimezones = mapDeprecatedTimezones.mapDeprecatedTimezones;
exports.format = format.format;
exports.formatDate = formatDate.formatDate;
exports.memoizedGetDateTimeFormat = formatDate.memoizedGetDateTimeFormat;
exports.getIanaTimeZone = timezone.getIanaTimeZone;

6

build/cjs/utilities/formatDate.js

@@ -5,4 +5,2 @@ 'use strict';

var _rollupPluginBabelHelpers = require('../_virtual/_rollupPluginBabelHelpers.js');
const intl = new Map();

@@ -38,5 +36,5 @@ function memoizedGetDateTimeFormat(locales, options) {

const adjustedDate = new Date(date.valueOf() - 12 * 60 * 60 * 1000);
return memoizedGetDateTimeFormat(locales, _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, options), {}, {
return memoizedGetDateTimeFormat(locales, { ...options,
timeZone: 'UTC'
})).format(adjustedDate);
}).format(adjustedDate);
}

@@ -43,0 +41,0 @@

export * from './apply-time-zone-offset';
export * from './constants';
export * from './get-date-diff';
export * from './get-date-time-parts';

@@ -13,2 +14,3 @@ export * from './get-time-zone-offset';

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

@@ -26,2 +28,3 @@ export * from './is-same-month';

export * from './utilities';
export * from './format';
//# sourceMappingURL=index.d.ts.map

@@ -1,4 +0,1 @@

function interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}
module.exports = interopRequireDefault(require("./build/cjs/index.js"));
module.exports = require("./build/cjs/index.js");
{
"name": "@shopify/dates",
"version": "2.0.0-wp5-beta.1",
"version": "2.0.0",
"license": "MIT",

@@ -24,9 +24,9 @@ "description": "Lightweight date operations library",

"engines": {
"node": ">=12.14.0"
"node": "^14.17.0 || >=16.0.0"
},
"dependencies": {
"@shopify/decorators": "^2.0.4"
"@shopify/decorators": "^3.0.0"
},
"devDependencies": {
"@shopify/jest-dom-mocks": "^4.0.0-wp5-beta.1"
"@shopify/jest-dom-mocks": "^4.0.0"
},

@@ -44,10 +44,9 @@ "files": [

"exports": {
"./": "./",
".": {
"esnext": "./index.esnext",
"import": "./index.mjs",
"require": "./index.js",
"esnext": "./index.esnext"
"require": "./index.js"
}
},
"gitHead": "3d18c950fedaa4f622f4177887b3ea297eb7d0d3"
"gitHead": "ef9afc562672dcda9d7800753dc6b777ecd2d751"
}

@@ -34,2 +34,41 @@ # `@shopify/dates`

### `format`
Lighter replacement for [`format()` from the `moment` library](https://momentjs.com/docs/#/displaying/format/).
Can output to any given locale / timezone (defaults to the system's locale & timezone).
Handles a subset of the tokens `moment().format()` handles, namely the following:
| | | |
| -----------: | ---- | -------------------------------------- |
| Month | M | 1 2 ... 11 12 |
| | MM | 01 02 ... 11 12 |
| | MMM | Jan Feb ... Nov Dec |
| | MMMM | January February ... November December |
| Day of Month | D | 1 2 ... 30 31 |
| | DD | 01 02 ... 30 31 |
| Day of Week | ddd | Sun Mon ... Fri Sat |
| | dddd | Sunday Monday ... Friday Saturday |
| Year | YY | 70 71 ... 29 30 |
| | YYYY | 1970 1971 ... 2029 2030 |
| Hour | H | 0 1 ... 22 23 |
| | HH | 00 01 ... 22 23 |
| | h | 1 2 ... 11 12 |
| | hh | 01 02 ... 11 12 |
| Minute | m | 0 1 ... 58 59 |
| | mm | 00 01 ... 58 59 |
| Second | s | 0 1 ... 58 59 |
| | ss | 00 01 ... 58 59 |
| AM/PM | A | AM PM |
| | a | am pm |
```ts
import {format} from '@shopify/dates';
const date = new Date(2021, 0, 14, 13, 2, 3);
const dateStr = format(date, 'YYYY-MM-DD h:mm:ss A'); // 2021-01-14 1:02:03 PM
const date2 = new Date(Date.UTC(2021, 1, 1));
const dateStr2 = format(date, 'M/D/YY', 'UTC', 'en-US'); // 1/1/21
```
### `formatDate`

@@ -36,0 +75,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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