Socket
Socket
Sign inDemoInstall

@formatjs/intl-datetimeformat

Package Overview
Dependencies
Maintainers
3
Versions
122
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@formatjs/intl-datetimeformat - npm Package Compare versions

Comparing version 4.1.2 to 4.1.3

lib/src/abstract/BasicFormatMatcher.d.ts

9

lib/src/core.js
import { __assign, __rest } from "tslib";
import { invariant, defineProperty, SupportedLocales, InitializeDateTimeFormat, IsValidTimeZoneName, CanonicalizeTimeZoneName, DATE_TIME_PROPS, FormatDateTime, FormatDateTimeToParts, CanonicalizeLocaleList, parseDateTimeSkeleton, ToNumber, FormatDateTimeRange, FormatDateTimeRangeToParts, OrdinaryHasInstance, } from '@formatjs/ecma402-abstract';
import { invariant, defineProperty, SupportedLocales, IsValidTimeZoneName, CanonicalizeTimeZoneName, CanonicalizeLocaleList, ToNumber, OrdinaryHasInstance, } from '@formatjs/ecma402-abstract';
import getInternalSlots from './get_internal_slots';
import links from './data/links';
import { unpack } from './packer';
import { FormatDateTime } from './abstract/FormatDateTime';
import { InitializeDateTimeFormat } from './abstract/InitializeDateTimeFormat';
import { DATE_TIME_PROPS } from './abstract/utils';
import { FormatDateTimeToParts } from './abstract/FormatDateTimeToParts';
import { FormatDateTimeRangeToParts } from './abstract/FormatDateTimeRangeToParts';
import { FormatDateTimeRange } from './abstract/FormatDateTimeRange';
import { parseDateTimeSkeleton } from './abstract/skeleton';
var UPPERCASED_LINKS = Object.keys(links).reduce(function (all, l) {

@@ -7,0 +14,0 @@ all[l.toUpperCase()] = links[l];

2

lib/src/to_locale_string.js
// eslint-disable-next-line import/no-cycle
import { DateTimeFormat } from './core';
import { ToDateTimeOptions, } from '@formatjs/ecma402-abstract';
import { ToDateTimeOptions } from './abstract/ToDateTimeOptions';
/**

@@ -5,0 +5,0 @@ * Number.prototype.toLocaleString ponyfill

{
"name": "@formatjs/intl-datetimeformat",
"version": "4.1.2",
"version": "4.1.3",
"description": "Intl.DateTimeFormat polyfill",

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

"dependencies": {
"@formatjs/ecma402-abstract": "1.9.1",
"@formatjs/ecma402-abstract": "1.9.2",
"tslib": "^2.1.0"
}
}

@@ -9,2 +9,9 @@ "use strict";

var packer_1 = require("./packer");
var FormatDateTime_1 = require("./abstract/FormatDateTime");
var InitializeDateTimeFormat_1 = require("./abstract/InitializeDateTimeFormat");
var utils_1 = require("./abstract/utils");
var FormatDateTimeToParts_1 = require("./abstract/FormatDateTimeToParts");
var FormatDateTimeRangeToParts_1 = require("./abstract/FormatDateTimeRangeToParts");
var FormatDateTimeRange_1 = require("./abstract/FormatDateTimeRange");
var skeleton_1 = require("./abstract/skeleton");
var UPPERCASED_LINKS = Object.keys(links_1.default).reduce(function (all, l) {

@@ -54,3 +61,3 @@ all[l.toUpperCase()] = links_1.default[l];

}
return ecma402_abstract_1.FormatDateTime(dtf, x, {
return FormatDateTime_1.FormatDateTime(dtf, x, {
getInternalSlots: get_internal_slots_1.default,

@@ -98,3 +105,3 @@ localeData: exports.DateTimeFormat.localeData,

}
ecma402_abstract_1.InitializeDateTimeFormat(this, locales, options, {
InitializeDateTimeFormat_1.InitializeDateTimeFormat(this, locales, options, {
tzData: exports.DateTimeFormat.tzData,

@@ -143,3 +150,3 @@ uppercaseLinks: UPPERCASED_LINKS,

}
if (ecma402_abstract_1.DATE_TIME_PROPS.indexOf(key) > -1) {
if (utils_1.DATE_TIME_PROPS.indexOf(key) > -1) {
if (internalSlots.dateStyle !== undefined ||

@@ -165,3 +172,3 @@ internalSlots.timeStyle !== undefined) {

}
return ecma402_abstract_1.FormatDateTimeToParts(this, date, {
return FormatDateTimeToParts_1.FormatDateTimeToParts(this, date, {
getInternalSlots: get_internal_slots_1.default,

@@ -185,3 +192,3 @@ localeData: exports.DateTimeFormat.localeData,

var y = ecma402_abstract_1.ToNumber(endDate);
return ecma402_abstract_1.FormatDateTimeRangeToParts(dtf, x, y, {
return FormatDateTimeRangeToParts_1.FormatDateTimeRangeToParts(dtf, x, y, {
getInternalSlots: get_internal_slots_1.default,

@@ -205,3 +212,3 @@ localeData: exports.DateTimeFormat.localeData,

var y = ecma402_abstract_1.ToNumber(endDate);
return ecma402_abstract_1.FormatDateTimeRange(dtf, x, y, {
return FormatDateTimeRange_1.FormatDateTimeRange(dtf, x, y, {
getInternalSlots: get_internal_slots_1.default,

@@ -245,20 +252,20 @@ localeData: exports.DateTimeFormat.localeData,

var processedData = tslib_1.__assign(tslib_1.__assign({}, rawData), { dateFormat: {
full: ecma402_abstract_1.parseDateTimeSkeleton(dateFormat.full),
long: ecma402_abstract_1.parseDateTimeSkeleton(dateFormat.long),
medium: ecma402_abstract_1.parseDateTimeSkeleton(dateFormat.medium),
short: ecma402_abstract_1.parseDateTimeSkeleton(dateFormat.short),
full: skeleton_1.parseDateTimeSkeleton(dateFormat.full),
long: skeleton_1.parseDateTimeSkeleton(dateFormat.long),
medium: skeleton_1.parseDateTimeSkeleton(dateFormat.medium),
short: skeleton_1.parseDateTimeSkeleton(dateFormat.short),
}, timeFormat: {
full: ecma402_abstract_1.parseDateTimeSkeleton(timeFormat.full),
long: ecma402_abstract_1.parseDateTimeSkeleton(timeFormat.long),
medium: ecma402_abstract_1.parseDateTimeSkeleton(timeFormat.medium),
short: ecma402_abstract_1.parseDateTimeSkeleton(timeFormat.short),
full: skeleton_1.parseDateTimeSkeleton(timeFormat.full),
long: skeleton_1.parseDateTimeSkeleton(timeFormat.long),
medium: skeleton_1.parseDateTimeSkeleton(timeFormat.medium),
short: skeleton_1.parseDateTimeSkeleton(timeFormat.short),
}, dateTimeFormat: {
full: ecma402_abstract_1.parseDateTimeSkeleton(dateTimeFormat.full).pattern,
long: ecma402_abstract_1.parseDateTimeSkeleton(dateTimeFormat.long).pattern,
medium: ecma402_abstract_1.parseDateTimeSkeleton(dateTimeFormat.medium).pattern,
short: ecma402_abstract_1.parseDateTimeSkeleton(dateTimeFormat.short).pattern,
full: skeleton_1.parseDateTimeSkeleton(dateTimeFormat.full).pattern,
long: skeleton_1.parseDateTimeSkeleton(dateTimeFormat.long).pattern,
medium: skeleton_1.parseDateTimeSkeleton(dateTimeFormat.medium).pattern,
short: skeleton_1.parseDateTimeSkeleton(dateTimeFormat.short).pattern,
}, formats: {} });
var _loop_2 = function (calendar) {
processedData.formats[calendar] = Object.keys(formats[calendar]).map(function (skeleton) {
return ecma402_abstract_1.parseDateTimeSkeleton(skeleton, formats[calendar][skeleton], intervalFormats[skeleton], intervalFormats.intervalFormatFallback);
return skeleton_1.parseDateTimeSkeleton(skeleton, formats[calendar][skeleton], intervalFormats[skeleton], intervalFormats.intervalFormatFallback);
});

@@ -265,0 +272,0 @@ };

@@ -6,3 +6,3 @@ "use strict";

var core_1 = require("./core");
var ecma402_abstract_1 = require("@formatjs/ecma402-abstract");
var ToDateTimeOptions_1 = require("./abstract/ToDateTimeOptions");
/**

@@ -18,3 +18,3 @@ * Number.prototype.toLocaleString ponyfill

function toLocaleDateString(x, locales, options) {
var dtf = new core_1.DateTimeFormat(locales, ecma402_abstract_1.ToDateTimeOptions(options, 'date', 'date'));
var dtf = new core_1.DateTimeFormat(locales, ToDateTimeOptions_1.ToDateTimeOptions(options, 'date', 'date'));
return dtf.format(x);

@@ -24,5 +24,5 @@ }

function toLocaleTimeString(x, locales, options) {
var dtf = new core_1.DateTimeFormat(locales, ecma402_abstract_1.ToDateTimeOptions(options, 'time', 'time'));
var dtf = new core_1.DateTimeFormat(locales, ToDateTimeOptions_1.ToDateTimeOptions(options, 'time', 'time'));
return dtf.format(x);
}
exports.toLocaleTimeString = toLocaleTimeString;

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 too big to display

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