Skip to content

Commit 0c304ab

Browse files
committed
fix(web): make date format functions globally accessible
Remove const declarations from exported functions (getDateFormat, getMediumDateFormat, etc.) to make them available on the global scope. Replace comma operators with semicolons in minified version to prevent functions from being block-scoped. This fixes the 'dart.global.getDateFormat is not a function' error when calling SystemDateTimeFormat().getDatePattern() on Flutter Web. Closes: #31
1 parent 3f4d66b commit 0c304ab

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

web/system_date_time_format.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ const getDateTimeFormatPattern = (options) => {
1818
.join("");
1919
};
2020

21-
const getDateFormat = () => getDateTimeFormatPattern({ dateStyle: "short" });
22-
const getMediumDateFormat = () => getDateTimeFormatPattern({ dateStyle: "medium" });
23-
const getLongDateFormat = () => getDateTimeFormatPattern({ dateStyle: "long" });
24-
const getFullDateFormat = () => getDateTimeFormatPattern({ dateStyle: "full" });
25-
const getTimeFormat = () => getDateTimeFormatPattern({ timeStyle: "short" });
21+
getDateFormat = () => getDateTimeFormatPattern({ dateStyle: "short" });
22+
getMediumDateFormat = () => getDateTimeFormatPattern({ dateStyle: "medium" });
23+
getLongDateFormat = () => getDateTimeFormatPattern({ dateStyle: "long" });
24+
getFullDateFormat = () => getDateTimeFormatPattern({ dateStyle: "full" });
25+
getTimeFormat = () => getDateTimeFormatPattern({ timeStyle: "short" });

web/system_date_time_format.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)