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

@abip/sp-common

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@abip/sp-common - npm Package Compare versions

Comparing version 0.1.27 to 0.1.29

1

dist/utils/date.d.ts

@@ -12,3 +12,4 @@ export declare function parseDateToDateTime(date: string | number): string;

export declare function getTimeOfDateTime(dateTime: string, options?: TimeOfDateTimeOptions): string;
export declare function buildDateTimeFromDateAndTime(date: Date | string, time: string): string;
export {};
//# sourceMappingURL=date.d.ts.map

@@ -9,3 +9,4 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.getTimeOfDateTime = exports.removeSecondsFromTime = exports.getDateOfDateTime = exports.parseDateToDateTime = void 0;
exports.buildDateTimeFromDateAndTime = exports.getTimeOfDateTime = exports.removeSecondsFromTime = exports.getDateOfDateTime = exports.parseDateToDateTime = void 0;
const date_fns_1 = require("date-fns");
function parseDateToDateTime(date) {

@@ -47,2 +48,23 @@ return new Date(date)

exports.getTimeOfDateTime = getTimeOfDateTime;
function buildDateTimeFromDateAndTime(date, time) {
let instance;
if (date) {
instance = new Date(`${date}`);
}
else {
instance = new Date();
}
if (time) {
const [hours, minutes] = time.split(':');
instance = (0, date_fns_1.add)(instance, {
hours: parseInt(hours, 10),
minutes: parseInt(minutes, 10),
});
}
return instance
.toISOString()
.slice(0, 19)
.replace('T', ' ');
}
exports.buildDateTimeFromDateAndTime = buildDateTimeFromDateAndTime;
//# sourceMappingURL=date.js.map

5

package.json
{
"name": "@abip/sp-common",
"version": "0.1.27",
"version": "0.1.29",
"description": "",

@@ -33,2 +33,3 @@ "main": "./dist/index",

"dependencies": {
"date-fns": "^2.28.0",
"lodash.template": "^4.5.0",

@@ -45,3 +46,3 @@ "nanoid": "^3.3.4"

},
"gitHead": "5876fd0d00876aae9efa652d96953d61b4394507"
"gitHead": "3aa7845cf41e1fd07ca5280a868ba8d5223a8b67"
}

@@ -8,2 +8,4 @@ /*

import { add } from 'date-fns';
export function parseDateToDateTime(date: string | number) {

@@ -63,1 +65,25 @@ return new Date(date)

}
export function buildDateTimeFromDateAndTime(date: Date | string, time: string) {
let instance : Date;
if (date) {
instance = new Date(`${date}`);
} else {
instance = new Date();
}
if (time) {
const [hours, minutes] = time.split(':');
instance = add(instance, {
hours: parseInt(hours, 10),
minutes: parseInt(minutes, 10),
});
}
return instance
.toISOString()
.slice(0, 19)
.replace('T', ' ');
}

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