@shopify/dates
Advanced tools
Comparing version 0.1.4 to 0.1.5
"use strict"; | ||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { | ||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; | ||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); | ||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; | ||
return c > 3 && r && Object.defineProperty(target, key, r), r; | ||
}; | ||
var __read = (this && this.__read) || function (o, n) { | ||
var m = typeof Symbol === "function" && o[Symbol.iterator]; | ||
if (!m) return o; | ||
var i = m.call(o), r, ar = [], e; | ||
try { | ||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); | ||
} | ||
catch (error) { e = { error: error }; } | ||
finally { | ||
try { | ||
if (r && !r.done && (m = i["return"])) m.call(i); | ||
} | ||
finally { if (e) throw e.error; } | ||
} | ||
return ar; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var tslib_1 = require("tslib"); | ||
var decorators_1 = require("@shopify/javascript-utilities/decorators"); | ||
@@ -171,3 +150,3 @@ var formatDate_1 = require("./utilities/formatDate"); | ||
// In Microsoft Edge, Intl.DateTimeFormat returns invisible characters around the individual numbers | ||
var _a = __read(timeString.split(':'), 3), dirtyHour = _a[0], dirtyMinute = _a[1], dirtySecond = _a[2]; | ||
var _a = tslib_1.__read(timeString.split(':'), 3), dirtyHour = _a[0], dirtyMinute = _a[1], dirtySecond = _a[2]; | ||
var rawHour = new RegExp(TWO_DIGIT_REGEX).exec(dirtyHour); | ||
@@ -188,24 +167,24 @@ var rawMinute = new RegExp(TWO_DIGIT_REGEX).exec(dirtyMinute); | ||
}; | ||
__decorate([ | ||
tslib_1.__decorate([ | ||
decorators_1.memoize(dateTimeCacheKey('year')) | ||
], DateTimeParts, "getYear", null); | ||
__decorate([ | ||
tslib_1.__decorate([ | ||
decorators_1.memoize(dateTimeCacheKey('month')) | ||
], DateTimeParts, "getMonth", null); | ||
__decorate([ | ||
tslib_1.__decorate([ | ||
decorators_1.memoize(dateTimeCacheKey('day')) | ||
], DateTimeParts, "getDay", null); | ||
__decorate([ | ||
tslib_1.__decorate([ | ||
decorators_1.memoize(dateTimeCacheKey('weekday')) | ||
], DateTimeParts, "getWeekday", null); | ||
__decorate([ | ||
tslib_1.__decorate([ | ||
decorators_1.memoize(dateTimeCacheKey('hour')) | ||
], DateTimeParts, "getHour", null); | ||
__decorate([ | ||
tslib_1.__decorate([ | ||
decorators_1.memoize(dateTimeCacheKey('minute')) | ||
], DateTimeParts, "getMinute", null); | ||
__decorate([ | ||
tslib_1.__decorate([ | ||
decorators_1.memoize(dateTimeCacheKey('second')) | ||
], DateTimeParts, "getSecond", null); | ||
__decorate([ | ||
tslib_1.__decorate([ | ||
decorators_1.memoize(dateTimeCacheKey('timePartsFallback')) | ||
@@ -212,0 +191,0 @@ ], DateTimeParts, "getTimePartsFallback", null); |
"use strict"; | ||
function __export(m) { | ||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; | ||
} | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__export(require("./apply-time-zone-offset")); | ||
__export(require("./get-date-time-parts")); | ||
__export(require("./get-time-zone-offset")); | ||
__export(require("./is-same-day")); | ||
__export(require("./is-same-month")); | ||
__export(require("./is-same-year")); | ||
__export(require("./is-today")); | ||
__export(require("./is-yesterday")); | ||
__export(require("./is-tomorrow")); | ||
__export(require("./parse-date-string")); | ||
__export(require("./sanitise-date-string")); | ||
__export(require("./unapply-time-zone-offset")); | ||
__export(require("./map-deprecated-timezones")); | ||
var tslib_1 = require("tslib"); | ||
tslib_1.__exportStar(require("./apply-time-zone-offset"), exports); | ||
tslib_1.__exportStar(require("./get-date-time-parts"), exports); | ||
tslib_1.__exportStar(require("./get-time-zone-offset"), exports); | ||
tslib_1.__exportStar(require("./is-same-day"), exports); | ||
tslib_1.__exportStar(require("./is-same-month"), exports); | ||
tslib_1.__exportStar(require("./is-same-year"), exports); | ||
tslib_1.__exportStar(require("./is-today"), exports); | ||
tslib_1.__exportStar(require("./is-yesterday"), exports); | ||
tslib_1.__exportStar(require("./is-tomorrow"), exports); | ||
tslib_1.__exportStar(require("./parse-date-string"), exports); | ||
tslib_1.__exportStar(require("./sanitise-date-string"), exports); | ||
tslib_1.__exportStar(require("./unapply-time-zone-offset"), exports); | ||
tslib_1.__exportStar(require("./map-deprecated-timezones"), exports); |
"use strict"; | ||
var __read = (this && this.__read) || function (o, n) { | ||
var m = typeof Symbol === "function" && o[Symbol.iterator]; | ||
if (!m) return o; | ||
var i = m.call(o), r, ar = [], e; | ||
try { | ||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); | ||
} | ||
catch (error) { e = { error: error }; } | ||
finally { | ||
try { | ||
if (r && !r.done && (m = i["return"])) m.call(i); | ||
} | ||
finally { if (e) throw e.error; } | ||
} | ||
return ar; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var tslib_1 = require("tslib"); | ||
var apply_time_zone_offset_1 = require("./apply-time-zone-offset"); | ||
@@ -34,3 +19,3 @@ /** | ||
} | ||
var _a = __read(dateTimeParts, 11), | ||
var _a = tslib_1.__read(dateTimeParts, 11), | ||
// @ts-ignore | ||
@@ -37,0 +22,0 @@ _ = _a[0], rawYear = _a[1], rawMonth = _a[2], rawDay = _a[3], rawHour = _a[4], rawMinute = _a[5], rawSecond = _a[6], timeZoneOffset = _a[7], sign = _a[8], rawTimeZoneHour = _a[9], rawTimeZoneMinute = _a[10]; |
"use strict"; | ||
var __assign = (this && this.__assign) || function () { | ||
__assign = Object.assign || function(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) | ||
t[p] = s[p]; | ||
} | ||
return t; | ||
}; | ||
return __assign.apply(this, arguments); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var tslib_1 = require("tslib"); | ||
function formatDate(date, locales, options) { | ||
@@ -19,3 +9,3 @@ if (options === void 0) { options = {}; } | ||
var adjustedDate = new Date(date.valueOf() - 12 * 60 * 60 * 1000); | ||
return Intl.DateTimeFormat(locales, __assign({}, options, { timeZone: 'UTC' })).format(adjustedDate); | ||
return Intl.DateTimeFormat(locales, tslib_1.__assign({}, options, { timeZone: 'UTC' })).format(adjustedDate); | ||
} | ||
@@ -22,0 +12,0 @@ return Intl.DateTimeFormat(locales, options).format(date); |
{ | ||
"name": "@shopify/dates", | ||
"version": "0.1.4", | ||
"version": "0.1.5", | ||
"license": "MIT", | ||
@@ -29,3 +29,3 @@ "description": "Lightweight date operations library.", | ||
"devDependencies": { | ||
"@shopify/jest-dom-mocks": "^2.1.0", | ||
"@shopify/jest-dom-mocks": "^2.1.1", | ||
"typescript": "~3.0.1" | ||
@@ -32,0 +32,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
28511
529