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

moment-parseformat

Package Overview
Dependencies
Maintainers
2
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

moment-parseformat - npm Package Compare versions

Comparing version 2.2.0 to 2.2.1

LICENSE.md

33

dist/moment-parseformat.js

@@ -18,6 +18,2 @@ (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.momentParseformat = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){

var abbreviatedMonthNames = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
var amDesignator = 'AM'
var pmDesignator = 'PM'
var lowerAMDesignator = 'am'
var lowerPMDesignator = 'pm'

@@ -34,6 +30,3 @@ var regexDayNames = new RegExp(dayNames.join('|'), 'i')

var regexTimezone = /((\+|-)\d\d:?\d\d)$/
var amOrPm = '(' + [amDesignator, pmDesignator].join('|') + ')'
var lowerAmOrPm = '(' + [lowerAMDesignator, lowerPMDesignator].join('|') + ')'
var regexLowerAmOrPm = new RegExp(lowerAmOrPm)
var regexUpperAmOrPm = new RegExp(amOrPm)
var amOrPm = '(' + ['AM?', 'PM?'].join('|') + ')'
var regexHoursWithLeadingZeroDigitMinutesSecondsAmPm = new RegExp('0\\d\\:\\d{1,2}\\:\\d{1,2}(\\s*)' + amOrPm, 'i')

@@ -130,14 +123,19 @@ var regexHoursWithLeadingZeroDigitMinutesAmPm = new RegExp('0\\d\\:\\d{1,2}(\\s*)' + amOrPm, 'i')

format = format.replace(regexISO8601HoursWithLeadingZeroMinutesSecondsDeciSeconds, 'HH:mm:ss.S')
function replaceWithAmPm (timeFormat) {
return function (match, whitespace, amPm) {
return timeFormat + whitespace + (amPm[0].toUpperCase() === amPm[0] ? 'A' : 'a')
}
}
// 05:30:20pm ☛ hh:mm:ssa
format = format.replace(regexHoursWithLeadingZeroDigitMinutesSecondsAmPm, 'hh:mm:ss$1')
format = format.replace(regexHoursWithLeadingZeroDigitMinutesSecondsAmPm, replaceWithAmPm('hh:mm:ss'))
// 10:30:20pm ☛ h:mm:ssa
format = format.replace(regexHoursMinutesSecondsAmPm, 'h:mm:ss$1')
format = format.replace(regexHoursMinutesSecondsAmPm, replaceWithAmPm('h:mm:ss'))
// 05:30pm ☛ hh:mma
format = format.replace(regexHoursWithLeadingZeroDigitMinutesAmPm, 'hh:mm$1')
format = format.replace(regexHoursWithLeadingZeroDigitMinutesAmPm, replaceWithAmPm('hh:mm'))
// 10:30pm ☛ h:mma
format = format.replace(regexHoursMinutesAmPm, 'h:mm$1')
format = format.replace(regexHoursMinutesAmPm, replaceWithAmPm('h:mm'))
// 05pm ☛ hha
format = format.replace(regexHoursWithLeadingZeroDigitAmPm, 'hh$1')
format = format.replace(regexHoursWithLeadingZeroDigitAmPm, replaceWithAmPm('hh'))
// 10pm ☛ ha
format = format.replace(regexHoursAmPm, 'h$1')
format = format.replace(regexHoursAmPm, replaceWithAmPm('h'))
// 05:30:20 ☛ HH:mm:ss

@@ -158,9 +156,2 @@ format = format.replace(regexHoursWithLeadingZeroMinutesSeconds, 'HH:mm:ss')

// Check if AM and determine the case of 'a' we need
if (regexUpperAmOrPm.test(dateString)) {
format += 'A'
} else if (regexLowerAmOrPm.test(dateString)) {
format += 'a'
}
// do we still have numbers left?

@@ -167,0 +158,0 @@

@@ -8,6 +8,2 @@ module.exports = parseFormat

var abbreviatedMonthNames = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
var amDesignator = 'AM'
var pmDesignator = 'PM'
var lowerAMDesignator = 'am'
var lowerPMDesignator = 'pm'

@@ -24,6 +20,3 @@ var regexDayNames = new RegExp(dayNames.join('|'), 'i')

var regexTimezone = /((\+|-)\d\d:?\d\d)$/
var amOrPm = '(' + [amDesignator, pmDesignator].join('|') + ')'
var lowerAmOrPm = '(' + [lowerAMDesignator, lowerPMDesignator].join('|') + ')'
var regexLowerAmOrPm = new RegExp(lowerAmOrPm)
var regexUpperAmOrPm = new RegExp(amOrPm)
var amOrPm = '(' + ['AM?', 'PM?'].join('|') + ')'
var regexHoursWithLeadingZeroDigitMinutesSecondsAmPm = new RegExp('0\\d\\:\\d{1,2}\\:\\d{1,2}(\\s*)' + amOrPm, 'i')

@@ -120,14 +113,19 @@ var regexHoursWithLeadingZeroDigitMinutesAmPm = new RegExp('0\\d\\:\\d{1,2}(\\s*)' + amOrPm, 'i')

format = format.replace(regexISO8601HoursWithLeadingZeroMinutesSecondsDeciSeconds, 'HH:mm:ss.S')
function replaceWithAmPm (timeFormat) {
return function (match, whitespace, amPm) {
return timeFormat + whitespace + (amPm[0].toUpperCase() === amPm[0] ? 'A' : 'a')
}
}
// 05:30:20pm ☛ hh:mm:ssa
format = format.replace(regexHoursWithLeadingZeroDigitMinutesSecondsAmPm, 'hh:mm:ss$1')
format = format.replace(regexHoursWithLeadingZeroDigitMinutesSecondsAmPm, replaceWithAmPm('hh:mm:ss'))
// 10:30:20pm ☛ h:mm:ssa
format = format.replace(regexHoursMinutesSecondsAmPm, 'h:mm:ss$1')
format = format.replace(regexHoursMinutesSecondsAmPm, replaceWithAmPm('h:mm:ss'))
// 05:30pm ☛ hh:mma
format = format.replace(regexHoursWithLeadingZeroDigitMinutesAmPm, 'hh:mm$1')
format = format.replace(regexHoursWithLeadingZeroDigitMinutesAmPm, replaceWithAmPm('hh:mm'))
// 10:30pm ☛ h:mma
format = format.replace(regexHoursMinutesAmPm, 'h:mm$1')
format = format.replace(regexHoursMinutesAmPm, replaceWithAmPm('h:mm'))
// 05pm ☛ hha
format = format.replace(regexHoursWithLeadingZeroDigitAmPm, 'hh$1')
format = format.replace(regexHoursWithLeadingZeroDigitAmPm, replaceWithAmPm('hh'))
// 10pm ☛ ha
format = format.replace(regexHoursAmPm, 'h$1')
format = format.replace(regexHoursAmPm, replaceWithAmPm('h'))
// 05:30:20 ☛ HH:mm:ss

@@ -148,9 +146,2 @@ format = format.replace(regexHoursWithLeadingZeroMinutesSeconds, 'HH:mm:ss')

// Check if AM and determine the case of 'a' we need
if (regexUpperAmOrPm.test(dateString)) {
format += 'A'
} else if (regexLowerAmOrPm.test(dateString)) {
format += 'a'
}
// do we still have numbers left?

@@ -157,0 +148,0 @@

@@ -64,3 +64,3 @@ {

},
"version": "2.2.0"
"version": "2.2.1"
}
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