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

comb

Package Overview
Dependencies
Maintainers
1
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

comb - npm Package Compare versions

Comparing version 0.2.4 to 0.2.5

40

lib/base/date/index.js

@@ -156,3 +156,3 @@ var string = require("./../string").string,

*/
getDaysInMonth:function (/*Date*/dateObject) {
getDaysInMonth: function (/*Date*/dateObject) {
// summary:

@@ -184,3 +184,3 @@ // Returns the number of days in the month used by dateObject

*/
isLeapYear:function (/*Date*/dateObject, utc) {
isLeapYear: function (/*Date*/dateObject, utc) {
var year = dateObject[utc ? "getUTCFullYear" : "getFullYear"]();

@@ -209,3 +209,3 @@ return (year % 400 === 0) || (year % 4 === 0 && year % 100 !== 0);

*/
isWeekend:function (/*Date?*/dateObject, utc) {
isWeekend: function (/*Date?*/dateObject, utc) {
// summary:

@@ -233,3 +233,3 @@ // Determines if the date falls on a weekend, according to local custom.

*/
getTimezoneName:getTimezoneName,
getTimezoneName: getTimezoneName,

@@ -267,3 +267,3 @@ /**

*/
compare:function (/*Date*/date1, /*Date*/date2, /*String*/portion) {
compare: function (/*Date*/date1, /*Date*/date2, /*String*/portion) {
date1 = new Date(date1);

@@ -343,3 +343,3 @@ date2 = new Date((date2 || new Date()));

*/
add:function (/*Date*/date, /*String*/interval, /*int*/amount) {
add: function (/*Date*/date, /*String*/interval, /*int*/amount) {
var res = addTransform(interval, date, amount || 0);

@@ -422,3 +422,3 @@ amount = res[0];

*/
difference:function (/*Date*/date1, /*Date?*/date2, /*String*/interval, utc) {
difference: function (/*Date*/date1, /*Date?*/date2, /*String*/interval, utc) {
date2 = date2 || new Date();

@@ -469,3 +469,3 @@ interval = interval || "day";

*/
parse:function (dateStr, format) {
parse: function (dateStr, format) {
if (!format) {

@@ -626,3 +626,3 @@ throw new Error('format required when calling comb.date.parse');

*/
format:function (date, format, utc) {
format: function (date, format, utc) {
utc = utc || false;

@@ -826,2 +826,24 @@ var fullYear, month, day, d, hour, minute, second, millisecond;

/**
* Adds the specified weekday/s to the current date.
*
* @param {Number} val the number of weekdays to add
*
* @return {Date} a date with the number of weekdays added
*/
comb.weekDaysFromNow = function (val) {
return date.add(new Date(), "weekdays", val);
};
/**
* Subtracts the specified weekday/s from the current date.
*
* @param {Number} val the number of weekdays to subtract
*
* @return {Date} a date with the number of weekdays subtracted
*/
comb.weekDaysAgo = function (val) {
return date.add(new Date(), "weekdays", -val);
};
/**
* Adds the specified hour/s to the current date.

@@ -828,0 +850,0 @@ *

var floor = Math.floor, round = Math.round, min = Math.min, pow = Math.pow, ceil = Math.ceil, abs = Math.abs;
var addMap = {
day:function addDay(date, amount) {
day: function addDay(date, amount) {
return [amount, "Date", false];
},
weekday:function addWeekday(date, amount) {
weekday: function addWeekday(date, amount) {
// Divide the increment time span into weekspans plus leftover days

@@ -30,3 +30,3 @@ // e.g., 8 days is one 5-day weekspan / and two leftover days

// New date is on Sat or Sun
if (trgt === 0 || trgt === 6) {
if ((trgt === 0 || trgt === 6) || ((trgt > 6 || trgt <= 0) && strt !== 6 && strt !== 0)) {
adj = (amount > 0) ? 2 : -2;

@@ -38,12 +38,12 @@ }

},
year:function addYear(date, amount) {
year: function addYear(date, amount) {
return [amount, "FullYear", true];
},
week:function addWeek(date, amount) {
week: function addWeek(date, amount) {
return [amount * 7, "Date", false];
},
quarter:function addYear(date, amount) {
quarter: function addYear(date, amount) {
return [amount * 3, "Month", true];
},
month:function addYear(date, amount) {
month: function addYear(date, amount) {
return [amount, "Month", true];

@@ -63,3 +63,3 @@ }

var differenceMap = {
"quarter":function quarterDifference(date1, date2, utc) {
"quarter": function quarterDifference(date1, date2, utc) {
var yearDiff = date2.getFullYear() - date1.getFullYear();

@@ -76,3 +76,3 @@ var m1 = date1[utc ? "getUTCMonth" : "getMonth"]();

"weekday":function weekdayDifference(date1, date2, utc) {
"weekday": function weekdayDifference(date1, date2, utc) {
var days = differenceTransform("day", date1, date2, utc), weeks;

@@ -116,6 +116,6 @@ var mod = days % 7;

},
year:function (date1, date2) {
year: function (date1, date2) {
return date2.getFullYear() - date1.getFullYear();
},
month:function (date1, date2, utc) {
month: function (date1, date2, utc) {
var m1 = date1[utc ? "getUTCMonth" : "getMonth"]();

@@ -125,18 +125,18 @@ var m2 = date2[utc ? "getUTCMonth" : "getMonth"]();

},
week:function (date1, date2, utc) {
week: function (date1, date2, utc) {
return round(differenceTransform("day", date1, date2, utc) / 7);
},
day:function (date1, date2) {
day: function (date1, date2) {
return 1.1574074074074074e-8 * (date2.getTime() - date1.getTime());
},
hour:function (date1, date2) {
hour: function (date1, date2) {
return 2.7777777777777776e-7 * (date2.getTime() - date1.getTime());
},
minute:function (date1, date2) {
minute: function (date1, date2) {
return 0.000016666666666666667 * (date2.getTime() - date1.getTime());
},
second:function (date1, date2) {
second: function (date1, date2) {
return 0.001 * (date2.getTime() - date1.getTime());
},
millisecond:function (date1, date2) {
millisecond: function (date1, date2) {
return date2.getTime() - date1.getTime();

@@ -143,0 +143,0 @@ }

{
"name": "comb",
"description": "A framework for node",
"version": "0.2.4",
"version": "0.2.5",
"keywords": ["OO", "Object Oriented", "Collections", "Tree", "HashTable", "Pool", "Logging", "Promise", "Promises", "Proxy"],

@@ -6,0 +6,0 @@ "repository": {

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 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