Skip to content

Commit

Permalink
Fix leaking handler
Browse files Browse the repository at this point in the history
  • Loading branch information
SlexAxton committed Mar 8, 2018
1 parent f08cb15 commit 296681b
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/date.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ Globalize.prototype.dateFormatter = function( options ) {
Globalize.dateToPartsFormatter =
Globalize.prototype.dateToPartsFormatter = function( options ) {
var args, cldr, numberFormatters, pad, pattern, properties, returnFn,
timeZone;
timeZone, ianaListener;

validateParameterTypePlainObject( options, "options" );

Expand All @@ -184,14 +184,15 @@ Globalize.prototype.dateToPartsFormatter = function( options ) {

cldr.on( "get", validateRequiredCldr );
if ( timeZone ) {
cldr.on( "get", validateRequiredIana( timeZone ) );
ianaListener = validateRequiredIana( timeZone );
cldr.on( "get", ianaListener );
}
pattern = dateExpandPattern( options, cldr );
validateOptionsSkeleton( pattern, options.skeleton );
properties = dateFormatProperties( pattern, cldr, timeZone );
cldr.off( "get", validateRequiredCldr );
if ( timeZone ) {
cldr.off( "get", validateRequiredIana( timeZone ) );
if ( ianaListener ) {
cldr.off( "get", ianaListener );
}

// Create needed number formatters.
Expand Down

0 comments on commit 296681b

Please sign in to comment.