diff --git a/runtime/main/extend/systemplugin/napi/i18n.js b/runtime/main/extend/systemplugin/napi/i18n.js index 56dcb24a..0b946057 100644 --- a/runtime/main/extend/systemplugin/napi/i18n.js +++ b/runtime/main/extend/systemplugin/napi/i18n.js @@ -92,6 +92,11 @@ export function mockI18N() { " may be different from that on a real device.") return BreakIteratorMock; }, + getTimeZone: function(...args) { + console.warn("I18N.getTimeZone interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return TimeZoneMock; + }, Util: { unitConvert: function(...args) { console.warn("I18N.Util.unitConvert interface mocked in the Previewer. How this interface works on the Previewer" + @@ -309,5 +314,27 @@ export function mockI18N() { return paramMock.paramStringMock; } } + const TimeZoneMock = { + getID: function() { + console.warn("I18N.TimeZone.getID interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return paramMock.paramStringMock; + }, + getDisplayName: function(...args) { + console.warn("I18N.TimeZone.getDisplayName interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return paramMock.paramStringMock; + }, + getRawOffset: function() { + console.warn("I18N.TimeZone.getRawOffset interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return paramMock.paramNumberMock; + }, + getOffset: function(...args) { + console.warn("I18N.TimeZone.getOffset interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return paramMock.paramNumberMock; + } + } return result; } \ No newline at end of file