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

@brightspace-ui/intl

Package Overview
Dependencies
Maintainers
3
Versions
56
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@brightspace-ui/intl - npm Package Compare versions

Comparing version 3.0.7 to 3.0.8

25

lib/dateTime.js

@@ -35,2 +35,15 @@ import {getDocumentLocaleSettings, getLanguage, merge} from './common.js';

function getDateStringWithTimezone(date, timezone) {
let dateString = `${date.month}/${date.date}/${date.year}, ${date.hours}:${date.minutes}:${date.seconds} ${timezone}`;
if (timezone.includes('-') || timezone.includes('+')) {
const re = /([A-Z]{3})(\+|-)([0-9]{1,2}):([0-9]{2})/;
const match = timezone.match(re);
if (match && match.length === 5) {
// YYYY-MM-DDTHH:mm:ss(+|-)HH:MM
dateString = `${date.year}-${date.month}-${date.date}T${date.hours}:${date.minutes}:${date.seconds}${match[2]}${prePadByZero(match[3], 2)}:${prePadByZero(match[4], 2)}`;
}
}
return dateString;
}
function getParts() {

@@ -212,4 +225,12 @@

const dateDate = new Date(date.year, date.month - 1, date.date, date.hours, date.minutes, date.seconds);
const datePrePad = {
year: date.year,
month: prePadByZero(date.month, 2),
date: prePadByZero(date.date, 2),
hours: prePadByZero(date.hours, 2),
minutes: prePadByZero(date.minutes, 2),
seconds: prePadByZero(date.seconds, 2)
};
const timezone = formatDateString(dateDate).split(' ')[2];
const dateString = `${date.month}/${date.date}/${date.year}, ${date.hours}:${date.minutes}:${date.seconds} ${timezone}`;
const dateString = getDateStringWithTimezone(datePrePad, timezone);
const parsedDateString = new Date(Date.parse(dateString));

@@ -219,3 +240,3 @@

const utcCorrectedTimezone = formatDateString(parsedDateString).split(' ')[2];
const dateStringInTimezone = `${date.month}/${date.date}/${date.year}, ${date.hours}:${date.minutes}:${date.seconds} ${utcCorrectedTimezone}`;
const dateStringInTimezone = getDateStringWithTimezone(datePrePad, utcCorrectedTimezone);
const utcCorrectedDate = new Date(Date.parse(dateStringInTimezone));

@@ -222,0 +243,0 @@

2

package.json
{
"name": "@brightspace-ui/intl",
"version": "3.0.7",
"version": "3.0.8",
"description": "Internationalization APIs for number, date, time and file size formatting and parsing in D2L Brightspace.",

@@ -5,0 +5,0 @@ "main": "lib/number.js",

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