Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions compile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ mkdir -p "$PACK_DIR"
# compile ts
node_modules/.bin/tsc -p "$SOURCE_DIR" --outDir "$PACK_DIR"

# run tslint
node_modules/tslint/bin/tslint --project "$SOURCE_DIR"/tsconfig.json --config "$SOURCE_DIR"/tslint.json

# make commonjs bundle for ANDROID
Expand Down
8 changes: 7 additions & 1 deletion src/nativescript-intl-common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export const LONG = "long";
export const SHORT = "short";
export const TWODIGIT = "2-digit";
export const FULL = "full";
export let resolvedPatterns = new Map();

export class DateTimeFormat implements intlDateTimeFormat {
constructor(private locale?: string, private options?: intlDateTimeFormatOptions, private pattern?: string) {
Expand Down Expand Up @@ -200,7 +201,12 @@ export class DateTimeFormat implements intlDateTimeFormat {
if (this.pattern) {
this._preparedPattern = this.pattern;
} else {
this._preparedPattern = this.preparePattern(this.getCorrectPatternForLocale(), this.options);
if (resolvedPatterns.has({locale: this.locale, options: this.options})) {
this._preparedPattern = resolvedPatterns.get({locale: this.locale, options: this.options});
} else {
this._preparedPattern = this.preparePattern(this.getCorrectPatternForLocale(), this.options);
resolvedPatterns.set({locale: this.locale, options: this.options}, this._preparedPattern);
}
}
}
return this._preparedPattern;
Expand Down