@@ -39,24 +39,24 @@ export default function polyfill(globalSpace) {
3939 const timeZone = ( options && options . timeZone ) || 'UTC' ;
4040
4141 if ( options === undefined ) {
42- // options is provided. this means
43- // we dont need to format a arbitraray timezone
42+ // options is not provided. this means
43+ // we don't need to format arbitrary timezone
4444 super ( locale , options ) ;
4545
4646 return ;
4747 }
4848
4949 if ( checkTimeZoneSupport ( timeZone ) ) {
50- // native method has support for timezone. no pollifyll logic needed.
50+ // native method has support for timezone. no polyfill logic needed.
5151 super ( locale , options ) ;
5252
5353 return ;
5454 }
5555
5656 const timeZoneData = gIntl . _timeZoneData . get ( timeZone ) ;
5757
58+ // check if we have timezone data for this timezone
5859 if ( ! timeZoneData ) {
59- // check if we have timezone data for this timezone
6060 throw new RangeError ( `invalid time zone in DateTimeFormat(): ${ timeZone } ` ) ;
6161 }
6262
@@ -70,14 +70,14 @@ export default function polyfill(globalSpace) {
7070 if ( options . timeZoneName !== undefined ) {
7171 // We need to include timeZoneName in date format.
7272 // Check if we have locale data to able to do that.
73- if ( ! ( gIntl . _localeData . get ( resolvedLocale ) && // availlabillity of localedata
74- Intl . _metaZoneData . get ( timeZone ) ) ) { // availlabillity of metaZone for this timeZone
73+ if ( ! ( gIntl . _localeData . get ( resolvedLocale ) && // availability of localedata
74+ Intl . _metaZoneData . get ( timeZone ) ) ) { // availability of metaZone for this timeZone
7575 throw new RangeError ( `unsupported value "${ options . timeZoneName } " for timeZone ${ timeZone } . requires locale data for ${ resolvedLocale } ` ) ;
7676 }
7777 }
7878
79- // to minimize pollution. everything we need to perform polyfill is wraped under one object.
80- this . _dateTimeFromatPolyfill = {
79+ // to minimize pollution everything we need to perform polyfill is wrapped under one object.
80+ this . _dateTimeFormatPolyfill = {
8181 optionTimeZone : timeZone ,
8282 optionTimeZoneName : options . timeZoneName ,
8383 timeZoneData : timeZoneData
@@ -92,7 +92,7 @@ export default function polyfill(globalSpace) {
9292 }
9393
9494 format ( date ) {
95- if ( ! this . _dateTimeFromatPolyfill ) {
95+ if ( ! this . _dateTimeFormatPolyfill ) {
9696 return super . format ( date ) ;
9797 }
9898
@@ -104,7 +104,7 @@ export default function polyfill(globalSpace) {
104104 date = new Date ( date ) ;
105105 }
106106
107- const polyfill = this . _dateTimeFromatPolyfill ;
107+ const polyfill = this . _dateTimeFormatPolyfill ;
108108 const timeZoneOffsetInfo = getTimeZoneOffsetInfo ( polyfill . timeZoneData , date ) ;
109109 const timeZoneOffset = timeZoneOffsetInfo . offset * 60000 ;
110110 const shiftedDate = new Date ( date . getTime ( ) + timeZoneOffset ) ; // We need to format time by offseting it
@@ -114,7 +114,7 @@ export default function polyfill(globalSpace) {
114114
115115 if ( doNeedToReplaceTimeZoneName ) {
116116 /*
117- Since our timeshifted native format will only return UTC timeZone Name e.g. "1/31/2017, 6:39:55 PM GMT"
117+ Since our timeshifted native format will only return UTC timeZone Name e.g. "1/31/2017, 6:39:55 PM GMT"
118118 We have to replace GMT that with actual timezone name. like "Pacific Standard Time"
119119 This is achived by replacing timeZoneNameUTC with timeZoneName
120120 */
@@ -147,11 +147,11 @@ export default function polyfill(globalSpace) {
147147 }
148148
149149 resolvedOptions ( ) {
150- if ( this . _dateTimeFromatPolyfill ) {
150+ if ( this . _dateTimeFormatPolyfill ) {
151151 // since we have altered timezone option for super.
152152 // we need to correct that before returing.
153153 const options = jsonClone ( super . resolvedOptions ( ) ) ;
154- options . timeZone = this . _dateTimeFromatPolyfill . optionTimeZone ;
154+ options . timeZone = this . _dateTimeFormatPolyfill . optionTimeZone ;
155155
156156 return options ;
157157 }
@@ -214,7 +214,7 @@ export default function polyfill(globalSpace) {
214214 if ( options . day === undefined &&
215215 options . month === undefined &&
216216 options . year === undefined ) {
217- // LocaleDateString must contain one or more from day month & year
217+ // LocaleDateString must contain one or more from day, month & year
218218 // if none is specified we should fallback to to choose day, month and year
219219 options = jsonClone ( options ) ;
220220 options . day = defaultDateOption . day ;
0 commit comments