diff --git a/ionic/components/virtual-scroll/test/virtual-scroll.spec.ts b/ionic/components/virtual-scroll/test/virtual-scroll.spec.ts index 3c2cc9e718..e910a15e38 100644 --- a/ionic/components/virtual-scroll/test/virtual-scroll.spec.ts +++ b/ionic/components/virtual-scroll/test/virtual-scroll.spec.ts @@ -535,7 +535,7 @@ describe('VirtualScroll', () => { function getView(width?:number, height?: number, top?: number, left?: number): any { return { - setLocal: function(){}, + context: {}, rootNodes: [{ nodeType: 1, offsetWidth: width, diff --git a/ionic/util/datetime-util.ts b/ionic/util/datetime-util.ts index 92ca06835b..cdc1f7a234 100644 --- a/ionic/util/datetime-util.ts +++ b/ionic/util/datetime-util.ts @@ -278,23 +278,21 @@ export function parseTemplate(template: string): string[] { let words = template.split(' ').filter(w => w.length > 0); words.forEach((word, i) => { - if (word.length) { - FORMAT_KEYS.forEach(format => { - if (word === format.f) { - if (word === FORMAT_A || word === FORMAT_a) { - // this format is an am/pm format, so it's an "a" or "A" - if ((formats.indexOf(FORMAT_h) < 0 && formats.indexOf(FORMAT_hh) < 0) || - (words[i - 1] !== FORMAT_m && words[i - 1] !== FORMAT_mm)) { - // template does not already have a 12-hour format - // or this am/pm format doesn't have a minute format immediately before it - // so do not treat this word "a" or "A" as an am/pm format - return; - } + FORMAT_KEYS.forEach(format => { + if (word === format.f) { + if (word === FORMAT_A || word === FORMAT_a) { + // this format is an am/pm format, so it's an "a" or "A" + if ((formats.indexOf(FORMAT_h) < 0 && formats.indexOf(FORMAT_hh) < 0) || + (words[i - 1] !== FORMAT_m && words[i - 1] !== FORMAT_mm)) { + // template does not already have a 12-hour format + // or this am/pm format doesn't have a minute format immediately before it + // so do not treat this word "a" or "A" as an am/pm format + return; } - formats.push(word); } - }); - } + formats.push(word); + } + }); }); return formats;