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

moment

Package Overview
Dependencies
Maintainers
1
Versions
76
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

moment - npm Package Compare versions

Comparing version 1.4.0 to 1.5.0

.jshintrc

2

lang/ca.js

@@ -25,3 +25,3 @@ (function () {

nextDay : function () {
return '[demá a ' + ((this.hours() !== 1) ? 'les' : 'la') + '] LT';
return '[demà a ' + ((this.hours() !== 1) ? 'les' : 'la') + '] LT';
},

@@ -28,0 +28,0 @@ nextWeek : function () {

@@ -8,2 +8,3 @@ (function () {

longDateFormat : {
LT : "h:mm A",
L : "DD/MM/YYYY",

@@ -33,3 +34,3 @@ LL : "D MMMM YYYY",

m : "minut",
mm : "minutter",
mm : "%d minutter",
h : "time",

@@ -36,0 +37,0 @@ hh : "%d timer",

@@ -21,3 +21,3 @@ (function () {

calendar : {
sameDay: "[Ajourd'hui à] LT",
sameDay: "[Aujourd'hui à] LT",
nextDay: '[Demain à] LT',

@@ -24,0 +24,0 @@ nextWeek: 'dddd [à] LT',

(function () {
var lang = {
var pluralRules = [
function (n) { return ((n % 10 === 1) && (n % 100 !== 11)); },
function (n) { return ((n % 10) >= 2 && (n % 10) <= 4 && ((n % 10) % 1) === 0) && ((n % 100) < 12 || (n % 100) > 14); },
function (n) { return ((n % 10) === 0 || ((n % 10) >= 5 && (n % 10) <= 9 && ((n % 10) % 1) === 0) || ((n % 100) >= 11 && (n % 100) <= 14 && ((n % 100) % 1) === 0)); },
function (n) { return true; }
],
plural = function (word, num) {
var forms = word.split('_'),
minCount = Math.min(pluralRules.length, forms.length),
i = -1;
while (++i < minCount) {
if (pluralRules[i](num)) {
return forms[i];
}
}
return forms[minCount - 1];
},
relativeTimeWithPlural = function (number, withoutSuffix, key) {
var format = {
'mm': 'минута_минуты_минут_минуты',
'hh': 'час_часа_часов_часа',
'dd': 'день_дня_дней_дня',
'MM': 'месяц_месяца_месяцев_месяца',
'yy': 'год_года_лет_года'
};
if (key === 'm') {
return withoutSuffix ? 'минута' : 'минуту';
}
else {
return number + ' ' + plural(format[key], +number);
}
},
lang = {
months : "январь_февраль_март_апрель_май_июнь_июль_август_сентябрь_октябрь_ноябрь_декабрь".split("_"),

@@ -13,3 +50,3 @@ monthsShort : "янв_фев_мар_апр_май_июн_июл_авг_сен_окт_ноя_дек".split("_"),

LLLL : "dddd, D MMMM YYYY LT"
},
},
calendar : {

@@ -20,3 +57,3 @@ sameDay: '[Сегодня в] LT',

nextWeek: function () {
return this.day() === 1 ? '[Во] dddd [в] LT' : '[В] dddd [в] LT';
return this.day() === 2 ? '[Во] dddd [в] LT' : '[В] dddd [в] LT';
},

@@ -26,8 +63,10 @@ lastWeek: function () {

case 0:
return '[В прошлое] dddd [в] LT';
case 1:
case 2:
case 4:
return '[В прошлый] dddd [в] LT';
case 3:
return '[В прошлый] dddd [в] LT';
case 5:
case 6:
return '[В прошлое] dddd [в] LT';
default:
return '[В прошлую] dddd [в] LT';

@@ -43,12 +82,12 @@ }

s : "несколько секунд",
m : "минут",
mm : "%d минут",
h : "часа",
hh : "%d часов",
d : "1 день",
dd : "%d дней",
m : relativeTimeWithPlural,
mm : relativeTimeWithPlural,
h : "час",
hh : relativeTimeWithPlural,
d : "день",
dd : relativeTimeWithPlural,
M : "месяц",
MM : "%d месяцев",
MM : relativeTimeWithPlural,
y : "год",
yy : "%d лет"
yy : relativeTimeWithPlural
},

@@ -55,0 +94,0 @@ ordinal : function (number) {

@@ -1,10 +0,7 @@

// Moment.js
//
// (c) 2011 Tim Wood
// Moment.js is freely distributable under the terms of the MIT license.
//
// Version 1.4.0
// moment.js
// version : 1.5.0
// author : Tim Wood
// license : MIT
// momentjs.com
/*global define:false */
(function (Date, undefined) {

@@ -18,3 +15,3 @@

i,
jsonRegex = /^\/?Date\((\d+)/i,
jsonRegex = /^\/?Date\((\-?\d+)/i,
charactersToReplace = /(\[[^\[]*\])|(\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|dddd?|do?|w[o|w]?|YYYY|YY|a|A|hh?|HH?|mm?|ss?|zz?|ZZ?|LT|LL?L?L?)/g,

@@ -25,9 +22,17 @@ nonuppercaseLetters = /[^A-Z]/g,

inputCharacters = /(\\)?([0-9]+|([a-zA-Z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+|([\+\-]\d\d:?\d\d))/gi,
isoRegex = /\d{4}.\d\d.\d\d(T(\d\d(.\d\d(.\d\d)?)?)?([\+\-]\d\d:?\d\d)?)?/,
isoFormat = 'YYYY-MM-DDTHH:mm:ssZ',
isoTimes = [
['HH:mm:ss', /T\d\d:\d\d:\d\d/],
['HH:mm', /T\d\d:\d\d/],
['HH', /T\d\d/]
],
timezoneParseRegex = /([\+\-]|\d\d)/gi,
VERSION = "1.4.0",
VERSION = "1.5.0",
shortcuts = 'Month|Date|Hours|Minutes|Seconds|Milliseconds'.split('|');
// Moment prototype object
function Moment(date) {
function Moment(date, isUTC) {
this._d = date;
this._isUTC = !!isUTC;
}

@@ -90,5 +95,4 @@

// format date using native date object
function formatDate(date, inputString) {
var m = new Moment(date),
currentMonth = m.month(),
function formatMoment(m, inputString) {
var currentMonth = m.month(),
currentDate = m.date(),

@@ -194,7 +198,7 @@ currentYear = m.year(),

case 'z' :
return (date.toString().match(timezoneRegex) || [''])[0].replace(nonuppercaseLetters, '');
return (m._d.toString().match(timezoneRegex) || [''])[0].replace(nonuppercaseLetters, '');
case 'Z' :
return (currentZone > 0 ? '+' : '-') + leftZeroFill(~~(Math.abs(currentZone) / 60), 2) + ':' + leftZeroFill(~~(Math.abs(currentZone) % 60), 2);
return (currentZone < 0 ? '-' : '+') + leftZeroFill(~~(Math.abs(currentZone) / 60), 2) + ':' + leftZeroFill(~~(Math.abs(currentZone) % 60), 2);
case 'ZZ' :
return (currentZone > 0 ? '+' : '-') + leftZeroFill(~~(10 * Math.abs(currentZone) / 6), 4);
return (currentZone < 0 ? '-' : '+') + leftZeroFill(~~(10 * Math.abs(currentZone) / 6), 4);
// LONG DATES

@@ -206,3 +210,3 @@ case 'L' :

case 'LT' :
return formatDate(date, moment.longDateFormat[input]);
return formatMoment(m, moment.longDateFormat[input]);
// DEFAULT

@@ -224,2 +228,3 @@ default :

formatParts = format.match(tokenCharacters),
len = Math.min(inputParts.length, formatParts.length),
i,

@@ -314,3 +319,3 @@ isPm;

}
for (i = 0; i < formatParts.length; i++) {
for (i = 0; i < len; i++) {
addTime(formatParts[i], inputParts[i]);

@@ -358,3 +363,3 @@ }

curDate = makeDateFromStringAndFormat(string, formats[i]);
curScore = compareArrays(inputParts, formatDate(curDate, formats[i]).match(inputCharacters));
curScore = compareArrays(inputParts, formatMoment(new Moment(curDate), formats[i]).match(inputCharacters));
if (curScore < scoreToBeat) {

@@ -368,4 +373,48 @@ scoreToBeat = curScore;

// date from iso format
function makeDateFromString(string) {
var format = 'YYYY-MM-DDT',
i;
if (isoRegex.exec(string)) {
for (i = 0; i < 3; i++) {
if (isoTimes[i][1].exec(string)) {
format += isoTimes[i][0];
break;
}
}
return makeDateFromStringAndFormat(string, format + 'Z');
}
return new Date(string);
}
// helper function for _date.from() and _date.fromNow()
function substituteTimeAgo(string, number, withoutSuffix) {
var rt = moment.relativeTime[string];
return (typeof rt === 'function') ?
rt(number || 1, !!withoutSuffix, string) :
rt.replace(/%d/i, number || 1);
}
function relativeTime(milliseconds, withoutSuffix) {
var seconds = round(Math.abs(milliseconds) / 1000),
minutes = round(seconds / 60),
hours = round(minutes / 60),
days = round(hours / 24),
years = round(days / 365),
args = seconds < 45 && ['s', seconds] ||
minutes === 1 && ['m'] ||
minutes < 45 && ['mm', minutes] ||
hours === 1 && ['h'] ||
hours < 22 && ['hh', hours] ||
days === 1 && ['d'] ||
days <= 25 && ['dd', days] ||
days <= 45 && ['M'] ||
days < 345 && ['MM', round(days / 30)] ||
years === 1 && ['y'] || ['yy', years];
args[2] = withoutSuffix;
return substituteTimeAgo.apply({}, args);
}
moment = function (input, format) {
if (input === null) {
if (input === null || input === '') {
return null;

@@ -392,2 +441,3 @@ }

isArray(input) ? dateFromArray(input) :
typeof input === 'string' ? makeDateFromString(input) :
new Date(input);

@@ -398,5 +448,51 @@ }

// creating with utc
moment.utc = function (input, format) {
if (isArray(input)) {
return new Moment(new Date(Date.UTC.apply({}, input)), true);
}
return (format && input) ? moment(input + ' 0', format + ' Z').utc() : moment(input).utc();
};
// humanizeDuration
moment.humanizeDuration = function (num, type, withSuffix) {
var difference = +num,
rel = moment.relativeTime,
output;
switch (type) {
case "seconds" :
difference *= 1000; // 1000
break;
case "minutes" :
difference *= 60000; // 60 * 1000
break;
case "hours" :
difference *= 3600000; // 60 * 60 * 1000
break;
case "days" :
difference *= 86400000; // 24 * 60 * 60 * 1000
break;
case "weeks" :
difference *= 604800000; // 7 * 24 * 60 * 60 * 1000
break;
case "months" :
difference *= 2592000000; // 30 * 24 * 60 * 60 * 1000
break;
case "years" :
difference *= 31536000000; // 365 * 24 * 60 * 60 * 1000
break;
default :
withSuffix = !!type;
break;
}
output = relativeTime(difference, !withSuffix);
return withSuffix ? (difference <= 0 ? rel.past : rel.future).replace(/%s/i, output) : output;
};
// version number
moment.version = VERSION;
// default format
moment.defaultFormat = isoFormat;
// language switching and caching

@@ -479,30 +575,7 @@ moment.lang = function (key, values) {

// helper function for _date.from() and _date.fromNow()
function substituteTimeAgo(string, number, withoutSuffix) {
var rt = moment.relativeTime[string];
return (typeof rt === 'function') ?
rt(number || 1, !!withoutSuffix, string) :
rt.replace(/%d/i, number || 1);
}
// compare moment object
moment.isMoment = function (obj) {
return obj instanceof Moment;
};
function relativeTime(milliseconds, withoutSuffix) {
var seconds = round(Math.abs(milliseconds) / 1000),
minutes = round(seconds / 60),
hours = round(minutes / 60),
days = round(hours / 24),
years = round(days / 365),
args = seconds < 45 && ['s', seconds] ||
minutes === 1 && ['m'] ||
minutes < 45 && ['mm', minutes] ||
hours === 1 && ['h'] ||
hours < 22 && ['hh', hours] ||
days === 1 && ['d'] ||
days <= 25 && ['dd', days] ||
days <= 45 && ['M'] ||
days < 345 && ['MM', round(days / 30)] ||
years === 1 && ['y'] || ['yy', years];
args[2] = withoutSuffix;
return substituteTimeAgo.apply({}, args);
}
// shortcut for prototype

@@ -531,4 +604,14 @@ moment.fn = Moment.prototype = {

utc : function () {
this._isUTC = true;
return this;
},
local : function () {
this._isUTC = false;
return this;
},
format : function (inputString) {
return formatDate(this._d, inputString);
return formatMoment(this, inputString ? inputString : moment.defaultFormat);
},

@@ -570,6 +653,3 @@

from : function (time, withoutSuffix) {
var difference = this.diff(time),
rel = moment.relativeTime,
output = relativeTime(difference, withoutSuffix);
return withoutSuffix ? output : (difference <= 0 ? rel.past : rel.future).replace(/%s/i, output);
return moment.humanizeDuration(this.diff(time), !withoutSuffix);
},

@@ -624,2 +704,10 @@

});
},
zone : function () {
return this._isUTC ? 0 : this._d.getTimezoneOffset();
},
daysInMonth : function () {
return this.clone().month(this.month() + 1).date(0).date();
}

@@ -631,7 +719,8 @@ };

moment.fn[name] = function (input) {
var utc = this._isUTC ? 'UTC' : '';
if (input != null) {
this._d['set' + key](input);
this._d['set' + utc + key](input);
return this;
} else {
return this._d['get' + key]();
return this._d['get' + utc + key]();
}

@@ -649,7 +738,2 @@ };

// add shortcut for timezone offset (no setter)
moment.fn.zone = function () {
return this._d.getTimezoneOffset();
};
// CommonJS module is defined

@@ -662,2 +746,3 @@ if (hasModule) {

}
/*global define:false */
if (typeof define === "function" && define.amd) {

@@ -664,0 +749,0 @@ define("moment", [], function () {

{
"name": "moment",
"version": "1.4.0",
"version": "1.5.0",
"description": "Moment.js is a javascript date library that helps create, manipulate, and format dates without extending the `Date` prototype.",

@@ -11,3 +11,3 @@ "homepage": "https://github.com/timrwood/moment",

],
"main": "./moment",
"main": "./moment.js",
"engines": {

@@ -28,11 +28,7 @@ "node": "*"

],
"dev-dependencies" : [
"uglify-js",
"jshint",
"gzip",
"jade",
"clean-css",
"qunit",
"bunker"
]
"devDependencies" : {
"jshint" : "latest",
"uglify-js" : "latest",
"nodeunit" : "latest"
}
}

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