Socket
Socket
Sign inDemoInstall

@briza/wegood

Package Overview
Dependencies
Maintainers
2
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@briza/wegood - npm Package Compare versions

Comparing version 1.0.5 to 1.0.6

4

changelog.md
# wegood changelog
## 1.0.6
* Bug fix: re-instate timezone dependency, but local timezone offset instead.
## 1.0.5

@@ -4,0 +8,0 @@

function _typeof(obj) {
"@babel/helpers - typeof";
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {

@@ -255,2 +257,21 @@ _typeof = function (obj) {

/**
* Get local timezone offset as ISO string
* E.g. '-05:00'
* @return {string} ISO timezone offset string
*/
function getISOTimezoneOffset() {
function pad(value) {
return value < 10 ? '0' + value : value;
}
var date = new Date();
var sign = date.getTimezoneOffset() > 0 ? '-' : '+';
var offset = Math.abs(date.getTimezoneOffset());
var hours = pad(Math.floor(offset / 60));
var minutes = pad(offset % 60);
return sign + hours + ':' + minutes;
}
/**
* Date validation rule.

@@ -297,3 +318,3 @@ * The value passed into the validation function must be a Date object

} else if (value.match(/^\d{4}-[0,1]\d-[0-3]\d$/)) {
value = new Date("".concat(value, "T00:00:00")); // Invalid
value = new Date("".concat(value, "T00:00:00").concat(getISOTimezoneOffset())); // Invalid
} else {

@@ -300,0 +321,0 @@ console.warn("the date validation rule, invalid \"".concat(value, "\" date value"));

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

function _typeof(obj) {
"@babel/helpers - typeof";
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {

@@ -260,2 +262,21 @@ _typeof = function (obj) {

/**
* Get local timezone offset as ISO string
* E.g. '-05:00'
* @return {string} ISO timezone offset string
*/
function getISOTimezoneOffset() {
function pad(value) {
return value < 10 ? '0' + value : value;
}
var date = new Date();
var sign = date.getTimezoneOffset() > 0 ? '-' : '+';
var offset = Math.abs(date.getTimezoneOffset());
var hours = pad(Math.floor(offset / 60));
var minutes = pad(offset % 60);
return sign + hours + ':' + minutes;
}
/**
* Date validation rule.

@@ -302,3 +323,3 @@ * The value passed into the validation function must be a Date object

} else if (value.match(/^\d{4}-[0,1]\d-[0-3]\d$/)) {
value = new Date("".concat(value, "T00:00:00")); // Invalid
value = new Date("".concat(value, "T00:00:00").concat(getISOTimezoneOffset())); // Invalid
} else {

@@ -305,0 +326,0 @@ console.warn("the date validation rule, invalid \"".concat(value, "\" date value"));

2

package.json
{
"name": "@briza/wegood",
"version": "1.0.5",
"version": "1.0.6",
"description": "Tiny validation library, so wegood with data.",

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

@@ -38,3 +38,3 @@ import { ValidationRule } from './rule';

*/
readonly rules: ValidationRule[];
get rules(): ValidationRule[];
/**

@@ -41,0 +41,0 @@ * Validate against the value.

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