Socket
Socket
Sign inDemoInstall

@beauwest/business-date-parser

Package Overview
Dependencies
0
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.14 to 1.0.15

3

CHANGELOG.md
# Change Log
## Release 1.0.15
- Fixed support for negative offsets in ISO 8601 formatted time parts.
## Release 1.0.14

@@ -4,0 +7,0 @@ - Added support for ISO 8601 formatted time parts.

2

index.js

@@ -352,3 +352,3 @@ function calculateFullYear(input) {

{
regex: /^(\d{2}):(\d{2}):(\d{2})([.]\d{1,3})?([+]\d{1,4})$/, // ISO 8601 Time Part
regex: /^(\d{2}):(\d{2}):(\d{2})([.]\d{1,3})?([-+]\d{1,4})$/, // ISO 8601 Time Part
parse: (matches, input) => {

@@ -355,0 +355,0 @@ return systemParseDate(`${new Date().toISOString().substring(0, 10)} ${input}`);

{
"name": "@beauwest/business-date-parser",
"version": "1.0.14",
"version": "1.0.15",
"description": "An opinionated, zero-dependency, fast user input parser for date & times.",

@@ -5,0 +5,0 @@ "type": "module",

@@ -419,2 +419,16 @@ import {parseDate, parseTime, parseDateAndTime} from '../index.js';

t.is(result.getMilliseconds(), 0);
});
test('datetime: PostgreSQL ISO 8601 -0200', t => {
const offset = new Date().getTimezoneOffset();
const offsetHours = Math.floor(offset / 60) - 2;
const offsetMinutes = (offset % 60);
const result = parseDateAndTime('2021-11-21 11:19:16-0200');
t.is(result.getFullYear(), 2021);
t.is(result.getMonth(), 10);
t.is(result.getDate(), 21);
t.is(result.getHours(), 11 - offsetHours);
t.is(result.getMinutes(), 19 - offsetMinutes);
t.is(result.getSeconds(), 16);
t.is(result.getMilliseconds(), 0);
});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc