From 78f516e384d2c239c1db1fde4e1ae29f9214e5e2 Mon Sep 17 00:00:00 2001 From: sunyaozu Date: Fri, 11 Mar 2022 14:45:23 +0800 Subject: [PATCH] add Class TimeZone Signed-off-by: sunyaozu --- runtime/main/extend/systemplugin/napi/i18n.js | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) 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