@openui5/sap.ui.core 1.110.0 → 1.111.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (279) hide show
  1. package/.eslintrc.json +1 -0
  2. package/package.json +1 -1
  3. package/src/jquery.sap.global.js +1 -1
  4. package/src/jquery.sap.properties.js +1 -1
  5. package/src/jquery.sap.resources.js +1 -1
  6. package/src/jquery.sap.script.js +1 -1
  7. package/src/jquery.sap.storage.js +3 -3
  8. package/src/sap/base/util/restricted/_CancelablePromise.js +1 -1
  9. package/src/sap/base/util/restricted/_castArray.js +1 -1
  10. package/src/sap/base/util/restricted/_compact.js +1 -1
  11. package/src/sap/base/util/restricted/_curry.js +1 -1
  12. package/src/sap/base/util/restricted/_debounce.js +1 -1
  13. package/src/sap/base/util/restricted/_difference.js +1 -1
  14. package/src/sap/base/util/restricted/_differenceBy.js +1 -1
  15. package/src/sap/base/util/restricted/_differenceWith.js +1 -1
  16. package/src/sap/base/util/restricted/_flatMap.js +1 -1
  17. package/src/sap/base/util/restricted/_flatMapDeep.js +1 -1
  18. package/src/sap/base/util/restricted/_flatMapDepth.js +1 -1
  19. package/src/sap/base/util/restricted/_flatten.js +1 -1
  20. package/src/sap/base/util/restricted/_flattenDeep.js +1 -1
  21. package/src/sap/base/util/restricted/_flattenDepth.js +1 -1
  22. package/src/sap/base/util/restricted/_intersection.js +1 -1
  23. package/src/sap/base/util/restricted/_intersectionBy.js +1 -1
  24. package/src/sap/base/util/restricted/_intersectionWith.js +1 -1
  25. package/src/sap/base/util/restricted/_isEqual.js +1 -1
  26. package/src/sap/base/util/restricted/_isEqualWith.js +1 -1
  27. package/src/sap/base/util/restricted/_isNil.js +1 -1
  28. package/src/sap/base/util/restricted/_max.js +1 -1
  29. package/src/sap/base/util/restricted/_merge.js +1 -1
  30. package/src/sap/base/util/restricted/_mergeWith.js +1 -1
  31. package/src/sap/base/util/restricted/_min.js +1 -1
  32. package/src/sap/base/util/restricted/_omit.js +1 -1
  33. package/src/sap/base/util/restricted/_pick.js +1 -1
  34. package/src/sap/base/util/restricted/_pickBy.js +1 -1
  35. package/src/sap/base/util/restricted/_throttle.js +1 -1
  36. package/src/sap/base/util/restricted/_toArray.js +1 -1
  37. package/src/sap/base/util/restricted/_union.js +1 -1
  38. package/src/sap/base/util/restricted/_unionBy.js +1 -1
  39. package/src/sap/base/util/restricted/_unionWith.js +1 -1
  40. package/src/sap/base/util/restricted/_uniq.js +1 -1
  41. package/src/sap/base/util/restricted/_uniqBy.js +1 -1
  42. package/src/sap/base/util/restricted/_uniqWith.js +1 -1
  43. package/src/sap/base/util/restricted/_without.js +1 -1
  44. package/src/sap/base/util/restricted/_xor.js +1 -1
  45. package/src/sap/base/util/restricted/_xorBy.js +1 -1
  46. package/src/sap/base/util/restricted/_xorWith.js +1 -1
  47. package/src/sap/base/util/restricted/_zipObject.js +1 -1
  48. package/src/sap/base/util/restricted/_zipObjectDeep.js +1 -1
  49. package/src/sap/ui/Device.js +3 -3
  50. package/src/sap/ui/Global.js +4 -4
  51. package/src/sap/ui/base/Event.js +1 -1
  52. package/src/sap/ui/base/EventProvider.js +1 -1
  53. package/src/sap/ui/base/Interface.js +1 -1
  54. package/src/sap/ui/base/ManagedObject.js +1 -1
  55. package/src/sap/ui/base/ManagedObjectMetadata.js +1 -1
  56. package/src/sap/ui/base/Metadata.js +1 -1
  57. package/src/sap/ui/base/Object.js +1 -1
  58. package/src/sap/ui/base/ObjectPool.js +1 -1
  59. package/src/sap/ui/core/.library +2 -2
  60. package/src/sap/ui/core/BusyIndicator.js +1 -1
  61. package/src/sap/ui/core/Component.js +58 -50
  62. package/src/sap/ui/core/ComponentContainer.js +1 -1
  63. package/src/sap/ui/core/ComponentMetadata.js +1 -1
  64. package/src/sap/ui/core/ComponentSupport.js +1 -1
  65. package/src/sap/ui/core/Configuration.js +4 -1
  66. package/src/sap/ui/core/Control.js +19 -7
  67. package/src/sap/ui/core/Core.js +2 -1
  68. package/src/sap/ui/core/CustomData.js +1 -1
  69. package/src/sap/ui/core/DeclarativeSupport.js +1 -1
  70. package/src/sap/ui/core/Element.js +98 -3
  71. package/src/sap/ui/core/ElementMetadata.js +1 -1
  72. package/src/sap/ui/core/EnabledPropagator.js +16 -1
  73. package/src/sap/ui/core/EventBus.js +1 -1
  74. package/src/sap/ui/core/Fragment.js +1 -1
  75. package/src/sap/ui/core/HTML.js +1 -1
  76. package/src/sap/ui/core/History.js +1 -1
  77. package/src/sap/ui/core/Icon.js +10 -6
  78. package/src/sap/ui/core/IndicationColorSupport.js +1 -1
  79. package/src/sap/ui/core/IntervalTrigger.js +1 -1
  80. package/src/sap/ui/core/InvisibleMessage.js +1 -1
  81. package/src/sap/ui/core/InvisibleRenderer.js +1 -1
  82. package/src/sap/ui/core/InvisibleText.js +1 -1
  83. package/src/sap/ui/core/Item.js +1 -1
  84. package/src/sap/ui/core/LabelEnablement.js +1 -1
  85. package/src/sap/ui/core/LayoutData.js +1 -1
  86. package/src/sap/ui/core/ListItem.js +1 -1
  87. package/src/sap/ui/core/LocalBusyIndicator.js +1 -1
  88. package/src/sap/ui/core/Locale.js +12 -11
  89. package/src/sap/ui/core/LocaleData.js +1 -1
  90. package/src/sap/ui/core/Manifest.js +1 -1
  91. package/src/sap/ui/core/Message.js +1 -1
  92. package/src/sap/ui/core/Patcher.js +35 -0
  93. package/src/sap/ui/core/Popup.js +1 -0
  94. package/src/sap/ui/core/RenderManager.js +286 -156
  95. package/src/sap/ui/core/Renderer.js +1 -1
  96. package/src/sap/ui/core/ResizeHandler.js +2 -2
  97. package/src/sap/ui/core/ScrollBar.js +1 -1
  98. package/src/sap/ui/core/SeparatorItem.js +1 -1
  99. package/src/sap/ui/core/Title.js +1 -1
  100. package/src/sap/ui/core/TooltipBase.js +1 -1
  101. package/src/sap/ui/core/UIArea.js +36 -4
  102. package/src/sap/ui/core/UIComponent.js +1 -1
  103. package/src/sap/ui/core/UIComponentMetadata.js +1 -1
  104. package/src/sap/ui/core/ValueStateSupport.js +1 -1
  105. package/src/sap/ui/core/VariantLayoutData.js +1 -1
  106. package/src/sap/ui/core/XMLComposite.js +1 -1
  107. package/src/sap/ui/core/XMLCompositeMetadata.js +1 -1
  108. package/src/sap/ui/core/_IconRegistry.js +1 -0
  109. package/src/sap/ui/core/cache/CacheManager.js +1 -1
  110. package/src/sap/ui/core/date/UI5Date.js +970 -0
  111. package/src/sap/ui/core/date/UniversalDate.js +803 -39
  112. package/src/sap/ui/core/date/UniversalDateUtils.js +170 -14
  113. package/src/sap/ui/core/delegate/ItemNavigation.js +1 -1
  114. package/src/sap/ui/core/delegate/ScrollEnablement.js +1 -1
  115. package/src/sap/ui/core/dnd/DragAndDrop.js +26 -15
  116. package/src/sap/ui/core/dnd/DragDropBase.js +1 -1
  117. package/src/sap/ui/core/dnd/DragDropInfo.js +1 -1
  118. package/src/sap/ui/core/dnd/DragInfo.js +5 -8
  119. package/src/sap/ui/core/dnd/DropInfo.js +1 -1
  120. package/src/sap/ui/core/format/DateFormat.js +39 -29
  121. package/src/sap/ui/core/format/FileSizeFormat.js +1 -0
  122. package/src/sap/ui/core/format/ListFormat.js +1 -0
  123. package/src/sap/ui/core/format/NumberFormat.js +31 -56
  124. package/src/sap/ui/core/format/TimezoneUtil.js +9 -7
  125. package/src/sap/ui/core/hyphenation/Hyphenation.js +1 -1
  126. package/src/sap/ui/core/library.js +22 -3
  127. package/src/sap/ui/core/message/ControlMessageProcessor.js +1 -1
  128. package/src/sap/ui/core/message/Message.js +1 -1
  129. package/src/sap/ui/core/message/MessageManager.js +1 -1
  130. package/src/sap/ui/core/message/MessageParser.js +1 -1
  131. package/src/sap/ui/core/message/MessageProcessor.js +1 -1
  132. package/src/sap/ui/core/mvc/HTMLView.js +1 -1
  133. package/src/sap/ui/core/mvc/JSONView.js +1 -1
  134. package/src/sap/ui/core/mvc/JSView.js +1 -1
  135. package/src/sap/ui/core/mvc/TemplateView.js +1 -1
  136. package/src/sap/ui/core/mvc/View.js +1 -1
  137. package/src/sap/ui/core/mvc/XMLView.js +1 -1
  138. package/src/sap/ui/core/plugin/DeclarativeSupport.js +1 -1
  139. package/src/sap/ui/core/plugin/LessSupport.js +1 -1
  140. package/src/sap/ui/core/plugin/TemplatingSupport.js +1 -1
  141. package/src/sap/ui/core/postmessage/Bus.js +1 -1
  142. package/src/sap/ui/core/postmessage/confirmationDialog.js +1 -1
  143. package/src/sap/ui/core/routing/Router.js +4 -3
  144. package/src/sap/ui/core/search/OpenSearchProvider.js +1 -1
  145. package/src/sap/ui/core/search/SearchProvider.js +1 -1
  146. package/src/sap/ui/core/service/Service.js +1 -1
  147. package/src/sap/ui/core/service/ServiceFactory.js +1 -1
  148. package/src/sap/ui/core/service/ServiceFactoryRegistry.js +1 -1
  149. package/src/sap/ui/core/support/Plugin.js +1 -1
  150. package/src/sap/ui/core/support/Support.js +1 -1
  151. package/src/sap/ui/core/support/plugins/ControlTree.js +14 -20
  152. package/src/sap/ui/core/support/plugins/Interaction.js +1 -1
  153. package/src/sap/ui/core/support/plugins/LocalStorage.js +1 -1
  154. package/src/sap/ui/core/support/plugins/Performance.js +1 -1
  155. package/src/sap/ui/core/support/plugins/Selector.js +1 -1
  156. package/src/sap/ui/core/support/plugins/TechInfo.js +1 -1
  157. package/src/sap/ui/core/support/plugins/Trace.js +1 -1
  158. package/src/sap/ui/core/support/plugins/ViewInfo.js +1 -1
  159. package/src/sap/ui/core/tmpl/DOMAttribute.js +1 -1
  160. package/src/sap/ui/core/tmpl/DOMElement.js +1 -1
  161. package/src/sap/ui/core/tmpl/HandlebarsTemplate.js +1 -1
  162. package/src/sap/ui/core/tmpl/Template.js +1 -1
  163. package/src/sap/ui/core/tmpl/TemplateControl.js +1 -1
  164. package/src/sap/ui/core/util/AsyncHintsHelper.js +1 -1
  165. package/src/sap/ui/core/util/Export.js +1 -1
  166. package/src/sap/ui/core/util/ExportCell.js +1 -1
  167. package/src/sap/ui/core/util/ExportColumn.js +1 -1
  168. package/src/sap/ui/core/util/ExportRow.js +1 -1
  169. package/src/sap/ui/core/util/ExportType.js +1 -1
  170. package/src/sap/ui/core/util/ExportTypeCSV.js +1 -1
  171. package/src/sap/ui/core/util/File.js +1 -1
  172. package/src/sap/ui/core/util/LibraryInfo.js +1 -1
  173. package/src/sap/ui/core/util/MockServer.js +1 -1
  174. package/src/sap/ui/core/util/PasteHelper.js +1 -1
  175. package/src/sap/ui/core/util/XMLPreprocessor.js +1 -0
  176. package/src/sap/ui/core/util/serializer/HTMLViewSerializer.js +1 -1
  177. package/src/sap/ui/core/util/serializer/Serializer.js +1 -1
  178. package/src/sap/ui/core/util/serializer/ViewSerializer.js +1 -1
  179. package/src/sap/ui/core/util/serializer/XMLViewSerializer.js +1 -1
  180. package/src/sap/ui/core/util/serializer/delegate/Delegate.js +1 -1
  181. package/src/sap/ui/core/util/serializer/delegate/HTML.js +1 -1
  182. package/src/sap/ui/core/util/serializer/delegate/XML.js +1 -1
  183. package/src/sap/ui/core/ws/ReadyState.js +1 -1
  184. package/src/sap/ui/core/ws/SapPcpWebSocket.js +1 -1
  185. package/src/sap/ui/core/ws/WebSocket.js +2 -1
  186. package/src/sap/ui/debug/ControlTree.js +1 -1
  187. package/src/sap/ui/debug/DebugEnv.js +1 -1
  188. package/src/sap/ui/debug/PropertyList.js +1 -1
  189. package/src/sap/ui/dom/isBehindOtherElement.js +11 -3
  190. package/src/sap/ui/model/ClientModel.js +1 -1
  191. package/src/sap/ui/model/CompositeDataState.js +1 -1
  192. package/src/sap/ui/model/CompositeType.js +1 -1
  193. package/src/sap/ui/model/DataState.js +1 -1
  194. package/src/sap/ui/model/MetaModel.js +1 -1
  195. package/src/sap/ui/model/Model.js +1 -11
  196. package/src/sap/ui/model/SelectionModel.js +1 -1
  197. package/src/sap/ui/model/SimpleType.js +1 -1
  198. package/src/sap/ui/model/TreeAutoExpandMode.js +1 -1
  199. package/src/sap/ui/model/Type.js +1 -1
  200. package/src/sap/ui/model/analytics/AnalyticalBinding.js +5 -1
  201. package/src/sap/ui/model/controlhelper/TreeBindingProxy.js +29 -15
  202. package/src/sap/ui/model/json/JSONModel.js +1 -1
  203. package/src/sap/ui/model/message/MessageModel.js +1 -1
  204. package/src/sap/ui/model/odata/ODataAnnotations.js +1 -1
  205. package/src/sap/ui/model/odata/ODataMessageParser.js +1 -1
  206. package/src/sap/ui/model/odata/ODataMetaModel.js +2 -2
  207. package/src/sap/ui/model/odata/ODataMetadata.js +1 -1
  208. package/src/sap/ui/model/odata/ODataModel.js +1 -1
  209. package/src/sap/ui/model/odata/type/Boolean.js +1 -1
  210. package/src/sap/ui/model/odata/type/Byte.js +1 -1
  211. package/src/sap/ui/model/odata/type/Currency.js +1 -1
  212. package/src/sap/ui/model/odata/type/Date.js +57 -21
  213. package/src/sap/ui/model/odata/type/DateTime.js +32 -3
  214. package/src/sap/ui/model/odata/type/DateTimeBase.js +62 -25
  215. package/src/sap/ui/model/odata/type/DateTimeOffset.js +35 -5
  216. package/src/sap/ui/model/odata/type/DateTimeWithTimezone.js +6 -5
  217. package/src/sap/ui/model/odata/type/Decimal.js +1 -1
  218. package/src/sap/ui/model/odata/type/Double.js +1 -1
  219. package/src/sap/ui/model/odata/type/Guid.js +1 -1
  220. package/src/sap/ui/model/odata/type/Int.js +1 -1
  221. package/src/sap/ui/model/odata/type/Int16.js +1 -1
  222. package/src/sap/ui/model/odata/type/Int32.js +1 -1
  223. package/src/sap/ui/model/odata/type/Int64.js +1 -1
  224. package/src/sap/ui/model/odata/type/ODataType.js +1 -1
  225. package/src/sap/ui/model/odata/type/Raw.js +1 -1
  226. package/src/sap/ui/model/odata/type/SByte.js +1 -1
  227. package/src/sap/ui/model/odata/type/Single.js +1 -1
  228. package/src/sap/ui/model/odata/type/Stream.js +1 -1
  229. package/src/sap/ui/model/odata/type/String.js +1 -1
  230. package/src/sap/ui/model/odata/type/Time.js +37 -2
  231. package/src/sap/ui/model/odata/type/TimeOfDay.js +39 -4
  232. package/src/sap/ui/model/odata/type/Unit.js +1 -1
  233. package/src/sap/ui/model/odata/v2/Context.js +1 -1
  234. package/src/sap/ui/model/odata/v2/ODataAnnotations.js +1 -1
  235. package/src/sap/ui/model/odata/v2/ODataContextBinding.js +1 -0
  236. package/src/sap/ui/model/odata/v2/ODataListBinding.js +11 -1
  237. package/src/sap/ui/model/odata/v2/ODataModel.js +4 -2
  238. package/src/sap/ui/model/odata/v2/ODataTreeBinding.js +1 -1
  239. package/src/sap/ui/model/odata/v4/AnnotationHelper.js +1 -1
  240. package/src/sap/ui/model/odata/v4/Context.js +98 -23
  241. package/src/sap/ui/model/odata/v4/ODataBinding.js +39 -9
  242. package/src/sap/ui/model/odata/v4/ODataContextBinding.js +4 -4
  243. package/src/sap/ui/model/odata/v4/ODataListBinding.js +57 -21
  244. package/src/sap/ui/model/odata/v4/ODataMetaModel.js +3 -4
  245. package/src/sap/ui/model/odata/v4/ODataModel.js +33 -8
  246. package/src/sap/ui/model/odata/v4/ODataParentBinding.js +15 -12
  247. package/src/sap/ui/model/odata/v4/ODataPropertyBinding.js +2 -2
  248. package/src/sap/ui/model/odata/v4/lib/_AggregationCache.js +43 -8
  249. package/src/sap/ui/model/odata/v4/lib/_AggregationHelper.js +92 -28
  250. package/src/sap/ui/model/odata/v4/lib/_Cache.js +74 -24
  251. package/src/sap/ui/model/odata/v4/lib/_Helper.js +14 -3
  252. package/src/sap/ui/model/odata/v4/lib/_MetadataConverter.js +12 -4
  253. package/src/sap/ui/model/odata/v4/lib/_MetadataRequestor.js +8 -3
  254. package/src/sap/ui/model/odata/v4/lib/_Requestor.js +22 -14
  255. package/src/sap/ui/model/odata/v4/lib/_V2MetadataConverter.js +8 -1
  256. package/src/sap/ui/model/resource/ResourceModel.js +1 -1
  257. package/src/sap/ui/model/type/Boolean.js +1 -1
  258. package/src/sap/ui/model/type/Currency.js +1 -1
  259. package/src/sap/ui/model/type/Date.js +1 -1
  260. package/src/sap/ui/model/type/DateInterval.js +190 -155
  261. package/src/sap/ui/model/type/DateTime.js +1 -1
  262. package/src/sap/ui/model/type/DateTimeInterval.js +1 -1
  263. package/src/sap/ui/model/type/FileSize.js +1 -1
  264. package/src/sap/ui/model/type/Float.js +1 -1
  265. package/src/sap/ui/model/type/Integer.js +1 -1
  266. package/src/sap/ui/model/type/String.js +1 -1
  267. package/src/sap/ui/model/type/Time.js +1 -1
  268. package/src/sap/ui/model/type/TimeInterval.js +1 -1
  269. package/src/sap/ui/model/type/Unit.js +1 -1
  270. package/src/sap/ui/model/xml/XMLModel.js +1 -1
  271. package/src/sap/ui/qunit/utils/ControlIterator.js +1 -1
  272. package/src/sap/ui/qunit/utils/MemoryLeakCheck.js +1 -1
  273. package/src/sap/ui/qunit/utils/waitForThemeApplied.js +4 -5
  274. package/src/sap/ui/test/generic/TestBase.js +3 -3
  275. package/src/sap/ui/test/generic/_EnforceSemanticRendering.js +4 -4
  276. package/src/sap/ui/thirdparty/jquery-mobile-custom.js +9 -1
  277. package/src/sap/ui/util/Storage.js +1 -1
  278. package/src/ui5loader-autoconfig.js +14 -11
  279. package/src/ui5loader.js +152 -3
@@ -0,0 +1,970 @@
1
+ /*!
2
+ * OpenUI5
3
+ * (c) Copyright 2009-2023 SAP SE or an SAP affiliate company.
4
+ * Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
5
+ */
6
+ sap.ui.define([
7
+ "sap/ui/core/Configuration",
8
+ "sap/ui/core/format/TimezoneUtil"
9
+ ], function (Configuration, TimezoneUtil) {
10
+ "use strict";
11
+
12
+ var aAllParts = ["year", "month", "day", "hour", "minute", "second", "fractionalSecond"],
13
+ // "2023", "2023-01", "2023-01-20", "+002023-01-20" are parsed by JavaScript Date as UTC
14
+ // timestamps, whereas "798", "2023-1", "2023-01-5" are parsed as local dates.
15
+ // If "Z", "GMT" or a time zone offset (e.g. 00:00+0530) is included in the input string,
16
+ // the string is parsed as a UTC related timestamp
17
+ rIsUTCString = /Z|GMT|:.*[\+|\-]|^([\+|\-]\d{2})?\d{4}(-\d{2}){0,2}$/,
18
+ aWeekday = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
19
+ aMonths = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
20
+ mWeekdayToDay = {Sun: 0, Mon: 1, Tue: 2, Wed: 3, Thu: 4, Fri: 5, Sat: 6};
21
+
22
+ /**
23
+ * Pads the start of the absolute given value with zeros up to the given length. If the given
24
+ * value is negative the leading minus is added in front of the zeros.
25
+ *
26
+ * @param {int} iValue The value to be padded
27
+ * @param {int} iLength The minimal length of the resulting string excluding the minus sign
28
+ * @returns {string} The padded string
29
+ */
30
+ function addLeadingZeros(iValue, iLength) {
31
+ return (iValue < 0 ? "-" : "") + Math.abs(iValue).toString().padStart(iLength, "0");
32
+ }
33
+
34
+ // eslint-disable-next-line valid-jsdoc
35
+ /**
36
+ * DO NOT call the constructor for UI5Date directly; use <code>UI5Date.getInstance</code>.
37
+ *
38
+ * @param {object} vDateParts
39
+ * An array like object containing the arguments as passed to
40
+ * <code>UI5Date.getInstance</code>
41
+ * @param {string} sTimezoneID
42
+ * The time zone ID to use for local methods of <code>Date</code>
43
+ *
44
+ * @alias module:sap/ui/core/date/UI5Date
45
+ * @author SAP SE
46
+ * @extends Date
47
+ * @class A date implementation considering the configured time zone
48
+ *
49
+ * A subclass of JavaScript <code>Date</code> that considers the configured time zone, see
50
+ * {@link sap.ui.core.Configuration.getTimezone}. All JavaScript <code>Date</code> functions
51
+ * that use the local browser time zone, like <code>getDate</code>,
52
+ * <code>setDate</code>, and <code>toString</code>, are overwritten and use the
53
+ * configured time zone to compute the values.
54
+ *
55
+ * Use {@link module:sap/ui/core/date/UI5Date.getInstance} to create new date instances.
56
+ *
57
+ * @hideconstructor
58
+ * @public
59
+ * @since 1.111.0
60
+ * @version 1.111.1
61
+ */
62
+ function UI5Date(vDateParts, sTimezoneID) {
63
+ var oDateInstance = UI5Date._createDateInstance(vDateParts);
64
+ // mark internal properties not enumerable -> deepEqual handles this as a Date instance
65
+ Object.defineProperties(this, {
66
+ sTimezoneID: {value: sTimezoneID},
67
+ oDate: {value: oDateInstance, writable: true},
68
+ oDateParts: {value: undefined, writable: true}
69
+ });
70
+
71
+ if (isNaN(oDateInstance)) {
72
+ return;
73
+ }
74
+
75
+ if (vDateParts.length > 1
76
+ || vDateParts.length === 1 && typeof vDateParts[0] === "string"
77
+ && !rIsUTCString.test(vDateParts[0])) {
78
+ this._setParts(aAllParts,
79
+ // JavaScript Date parsed the arguments already in local browser time zone
80
+ [oDateInstance.getFullYear(), oDateInstance.getMonth(), oDateInstance.getDate(),
81
+ oDateInstance.getHours(), oDateInstance.getMinutes(), oDateInstance.getSeconds(),
82
+ oDateInstance.getMilliseconds()]);
83
+ }
84
+ }
85
+
86
+ UI5Date.prototype = Object.create(Date.prototype, {
87
+ constructor: {
88
+ value: Date
89
+ }
90
+ });
91
+ // QUnit uses Object.prototype.toString.call and expects "[object Date]" for dates; UI5Date
92
+ // shall be treated as a JavaScript Date so Symbol.toStringTag has to be "Date"
93
+ UI5Date.prototype[Symbol.toStringTag] = "Date";
94
+
95
+ /**
96
+ * Returns the value for the requested date part (e.g. "month", "year", "hour") of this date
97
+ * according to the configured time zone.
98
+ *
99
+ * @param {string} sPart The date part name
100
+ * @returns {int} The value of the date part
101
+ *
102
+ * @private
103
+ */
104
+ UI5Date.prototype._getPart = function (sPart) {
105
+ var iResult;
106
+
107
+ if (isNaN(this.oDate)) {
108
+ return NaN;
109
+ }
110
+
111
+ this.oDateParts = this.oDateParts || TimezoneUtil._getParts(this.oDate, this.sTimezoneID);
112
+ if (sPart === "weekday") {
113
+ return mWeekdayToDay[this.oDateParts.weekday];
114
+ }
115
+
116
+ iResult = parseInt(this.oDateParts[sPart]);
117
+ if (sPart === "month") {
118
+ iResult -= 1;
119
+ } else if (sPart === "year") {
120
+ if (this.oDateParts.era === "B") {
121
+ iResult = 1 - iResult;
122
+ }
123
+ }
124
+
125
+ return iResult;
126
+ };
127
+
128
+ /**
129
+ * Updates this date instance by setting the given parts in the configured time zone.
130
+ *
131
+ * @param {string[]} aParts
132
+ * The names of the date parts to be updated, supported names are: "year", "month", "day",
133
+ * "hour", "minute", "second", "fractionalSecond"
134
+ * @param {object} aValues
135
+ * The arguments object of the local setters
136
+ * @returns {int}
137
+ * The milliseconds of the new timestamp based on the UNIX epoch, or <code>NaN</code> if the
138
+ * timestamp could not be created
139
+ *
140
+ * @private
141
+ */
142
+ UI5Date.prototype._setParts = function (aParts, aValues) {
143
+ var i, oCurrentDateParts, oNewDateAsUTCTimestamp, iNewTimestamp, sPart, vValue,
144
+ oDateParts = {},
145
+ iMaxLength = Math.min(aParts.length, aValues.length);
146
+
147
+ if (iMaxLength === 0) {
148
+ return this.setTime(NaN);
149
+ }
150
+
151
+ for (i = 0; i < iMaxLength; i += 1) {
152
+ // convert the value to number as JavaScript Date does it;
153
+ // +"" -> 0, +null -> 0, +undefined -> NaN, +"foo" -> NaN, +"4" -> 4
154
+ vValue = parseInt(+aValues[i]);
155
+ sPart = aParts[i];
156
+ if (isNaN(vValue)) {
157
+ return this.setTime(NaN);
158
+ }
159
+
160
+ if (sPart === "month") {
161
+ vValue += 1;
162
+ } else if (sPart === "year") {
163
+ if (vValue <= 0) {
164
+ vValue = 1 - vValue;
165
+ oDateParts.era = "B";
166
+ } else {
167
+ oDateParts.era = "A";
168
+ }
169
+ }
170
+ oDateParts[sPart] = vValue.toString();
171
+ }
172
+ if (this.oDateParts) {
173
+ oCurrentDateParts = this.oDateParts;
174
+ } else if (isNaN(this.oDate)) {
175
+ //era and year are given at least
176
+ oCurrentDateParts = {day: "1", fractionalSecond: "0", hour: "0", minute: "0",
177
+ month: "1", second: "0"};
178
+ } else {
179
+ oCurrentDateParts = TimezoneUtil._getParts(this.oDate, this.sTimezoneID);
180
+ }
181
+ oDateParts = Object.assign({}, oCurrentDateParts, oDateParts);
182
+
183
+ // NaN may happen if no year is given if current date is invalid
184
+ oNewDateAsUTCTimestamp = TimezoneUtil._getDateFromParts(oDateParts);
185
+ if (isNaN(oNewDateAsUTCTimestamp)) {
186
+ return this.setTime(NaN);
187
+ }
188
+
189
+ iNewTimestamp = oNewDateAsUTCTimestamp.getTime()
190
+ + TimezoneUtil.calculateOffset(oNewDateAsUTCTimestamp, this.sTimezoneID) * 1000;
191
+ return this.setTime(iNewTimestamp);
192
+ };
193
+
194
+ /**
195
+ * Returns the day of the month of this date instance according to the configured time zone,
196
+ * see <code>Date.prototype.getDate</code>.
197
+ *
198
+ * @returns {int}
199
+ * A number between 1 and 31 representing the day of the month of this date instance according
200
+ * to the configured time zone
201
+ *
202
+ * @public
203
+ */
204
+ UI5Date.prototype.getDate = function () {
205
+ return this._getPart("day");
206
+ };
207
+
208
+ /**
209
+ * Returns the day of the week of this date instance according to the configured time zone,
210
+ * see <code>Date.prototype.getDay</code>.
211
+ *
212
+ * @returns {int}
213
+ * A number between 0 (Sunday) and 6 (Saturday) representing the day of the week of this date
214
+ * instance according to the configured time zone
215
+ *
216
+ * @public
217
+ */
218
+ UI5Date.prototype.getDay = function () {
219
+ return this._getPart("weekday");
220
+ };
221
+
222
+ /**
223
+ * Returns the year of this date instance according to the configured time zone,
224
+ * see <code>Date.prototype.getFullYear</code>.
225
+ *
226
+ * @returns {int} The year of this date instance according to the configured time zone
227
+ *
228
+ * @public
229
+ */
230
+ UI5Date.prototype.getFullYear = function () {
231
+ return this._getPart("year");
232
+ };
233
+
234
+ /**
235
+ * Returns the hours of this date instance according to the configured time zone, see
236
+ * <code>Date.prototype.getHours</code>.
237
+ *
238
+ * @returns {int}
239
+ * A number between 0 and 23 representing the hours of this date instance according to the
240
+ * configured time zone
241
+ *
242
+ * @public
243
+ */
244
+ UI5Date.prototype.getHours = function () {
245
+ return this._getPart("hour");
246
+ };
247
+
248
+ /**
249
+ * Returns the milliseconds of this date instance according to the configured time zone,
250
+ * see <code>Date.prototype.getMilliseconds</code>.
251
+ *
252
+ * @returns {int}
253
+ * A number between 0 and 999 representing the milliseconds of this date instance according to
254
+ * the configured time zone
255
+ *
256
+ * @public
257
+ */
258
+ UI5Date.prototype.getMilliseconds = function () {
259
+ return this._getPart("fractionalSecond");
260
+ };
261
+
262
+ /**
263
+ * Returns the minutes of this date instance according to the configured time zone,
264
+ * see <code>Date.prototype.getMinutes</code>.
265
+ *
266
+ * @returns {int}
267
+ * A number between 0 and 59 representing the minutes of this date instance according to the
268
+ * configured time zone
269
+ *
270
+ * @public
271
+ */
272
+ UI5Date.prototype.getMinutes = function () {
273
+ return this._getPart("minute");
274
+ };
275
+
276
+ /**
277
+ * Returns the month index of this date instance according to the configured time zone,
278
+ * see <code>Date.prototype.getMonth</code>.
279
+ *
280
+ * @returns {int}
281
+ * The month index between 0 (January) and 11 (December) of this date instance according to
282
+ * the configured time zone
283
+ *
284
+ * @public
285
+ */
286
+ UI5Date.prototype.getMonth = function () {
287
+ return this._getPart("month");
288
+ };
289
+
290
+ /**
291
+ * Returns the seconds of this date instance according to the configured time zone,
292
+ * see <code>Date.prototype.getSeconds</code>.
293
+ *
294
+ * @returns {int}
295
+ * A number between 0 and 59 representing the seconds of this date instance according to the
296
+ * configured time zone
297
+ *
298
+ * @public
299
+ */
300
+ UI5Date.prototype.getSeconds = function () {
301
+ return this._getPart("second");
302
+ };
303
+
304
+ /**
305
+ * Returns the difference in minutes between the UTC and the configured time zone for this date,
306
+ * see <code>Date.prototype.getTimezoneOffset</code>.
307
+ *
308
+ * @returns {int}
309
+ * The difference in minutes between the UTC and the configured time zone for this date
310
+ *
311
+ * @public
312
+ */
313
+ UI5Date.prototype.getTimezoneOffset = function () {
314
+ return TimezoneUtil.calculateOffset(this.oDate, this.sTimezoneID) / 60;
315
+ };
316
+
317
+ /**
318
+ * Returns the year of this date instance minus 1900 according to the configured time zone,
319
+ * see <code>Date.prototype.getYear</code>.
320
+ *
321
+ * @returns {int}
322
+ * The year of this date instance minus 1900 according to the configured time zone
323
+ *
324
+ * @deprecated since version 1.111.0 as it is deprecated in JavaScript Date; use
325
+ * {@link #getFullYear} instead
326
+ * @public
327
+ */
328
+ UI5Date.prototype.getYear = function () {
329
+ return this._getPart("year") - 1900;
330
+ };
331
+
332
+ /**
333
+ * Sets the day of the month for this date instance considering the configured time zone,
334
+ * see <code>Date.prototype.setDate</code>.
335
+ *
336
+ * @param {int} iDay
337
+ * An integer representing the new day value, see <code>Date.prototype.setDate</code>
338
+ * @returns {int}
339
+ * The milliseconds of the new timestamp based on the UNIX epoch, or <code>NaN</code> if the
340
+ * timestamp could not be updated
341
+ *
342
+ * @public
343
+ */
344
+ UI5Date.prototype.setDate = function (iDay) {
345
+ return this._setParts(["day"], arguments);
346
+ };
347
+
348
+ /**
349
+ * Sets the year, month and day for this date instance considering the configured time zone,
350
+ * see <code>Date.prototype.setFullYear</code>.
351
+ *
352
+ * @param {int} iYear An integer representing the new year value
353
+ * @param {int} [iMonth] An integer representing the new month index
354
+ * @param {int} [iDay] An integer representing the new day value
355
+ * @returns {int}
356
+ * The milliseconds of the new timestamp based on the UNIX epoch, or <code>NaN</code> if the
357
+ * timestamp could not be updated
358
+ *
359
+ * @public
360
+ */
361
+ UI5Date.prototype.setFullYear = function (iYear, iMonth, iDay) {
362
+ return this._setParts(["year", "month", "day"], arguments);
363
+ };
364
+
365
+ /**
366
+ * Sets the hours, minutes, seconds and milliseconds for this date instance considering the
367
+ * configured time zone, see <code>Date.prototype.setHours</code>.
368
+ *
369
+ * @param {int} iHours An integer representing the new hour value
370
+ * @param {int} [iMinutes] An integer representing the new minutes value
371
+ * @param {int} [iSeconds] An integer representing the new seconds value
372
+ * @param {int} [iMilliseconds] An integer representing the new milliseconds value
373
+ * @returns {int}
374
+ * The milliseconds of the new timestamp based on the UNIX epoch, or <code>NaN</code> if the
375
+ * timestamp could not be updated
376
+ *
377
+ * @public
378
+ */
379
+ UI5Date.prototype.setHours = function (iHours, iMinutes, iSeconds, iMilliseconds) {
380
+ return this._setParts(["hour", "minute", "second", "fractionalSecond"], arguments);
381
+ };
382
+
383
+ /**
384
+ * Sets the milliseconds for this date instance considering the configured time zone, see
385
+ * <code>Date.prototype.setMilliseconds</code>.
386
+ *
387
+ * @param {int} iMilliseconds An integer representing the new milliseconds value
388
+ * @returns {int}
389
+ * The milliseconds of the new timestamp based on the UNIX epoch, or <code>NaN</code> if the
390
+ * timestamp could not be updated
391
+ *
392
+ * @public
393
+ */
394
+ UI5Date.prototype.setMilliseconds = function (iMilliseconds) {
395
+ return this._setParts(["fractionalSecond"], arguments);
396
+ };
397
+
398
+ /**
399
+ * Sets the minutes, seconds and milliseconds for this date instance considering the configured
400
+ * time zone, see <code>Date.prototype.setMinutes</code>.
401
+ *
402
+ * @param {int} iMinutes An integer representing the new minutes value
403
+ * @param {int} [iSeconds] An integer representing the new seconds value
404
+ * @param {int} [iMilliseconds] An integer representing the new milliseconds value
405
+ * @returns {int}
406
+ * The milliseconds of the new timestamp based on the UNIX epoch, or <code>NaN</code> if the
407
+ * timestamp could not be updated
408
+ *
409
+ * @public
410
+ */
411
+ UI5Date.prototype.setMinutes = function (iMinutes, iSeconds, iMilliseconds) {
412
+ return this._setParts(["minute", "second", "fractionalSecond"], arguments);
413
+ };
414
+
415
+ /**
416
+ * Sets the month and day for this date instance considering the configured time zone,
417
+ * see <code>Date.prototype.setMonth</code>.
418
+ *
419
+ * @param {int} iMonth An integer representing the new month index
420
+ * @param {int} [iDay] An integer representing the new day value
421
+ * @returns {int}
422
+ * The milliseconds of the new timestamp based on the UNIX epoch, or <code>NaN</code> if the
423
+ * timestamp could not be updated
424
+ *
425
+ * @public
426
+ */
427
+ UI5Date.prototype.setMonth = function (iMonth, iDay) {
428
+ return this._setParts(["month", "day"], arguments);
429
+ };
430
+
431
+ /**
432
+ * Sets the seconds and milliseconds for this date instance considering the configured time zone,
433
+ * see <code>Date.prototype.setSeconds</code>.
434
+ *
435
+ * @param {int} iSeconds An integer representing the new seconds value
436
+ * @param {int} [iMilliseconds] An integer representing the new milliseconds value
437
+ * @returns {int}
438
+ * The milliseconds of the new timestamp based on the UNIX epoch, or <code>NaN</code> if the
439
+ * timestamp could not be updated
440
+ *
441
+ * @public
442
+ */
443
+ UI5Date.prototype.setSeconds = function (iSeconds, iMilliseconds) {
444
+ return this._setParts(["second", "fractionalSecond"], arguments);
445
+ };
446
+
447
+ /**
448
+ * Sets this date object to the given time represented by a number of milliseconds based on the
449
+ * UNIX epoch and resets the previously set date parts, see
450
+ * <code>Date.prototype.setTime</code>.
451
+ *
452
+ * @param {int} iTime The date time in milliseconds based in the UNIX epoch
453
+ * @returns {int}
454
+ * The milliseconds of the new timestamp based on the UNIX epoch, or <code>NaN</code> if the
455
+ * timestamp could not be updated
456
+ *
457
+ * @public
458
+ */
459
+ UI5Date.prototype.setTime = function (iTime) {
460
+ this.oDateParts = undefined;
461
+ return this.oDate.setTime(iTime);
462
+ };
463
+
464
+ /**
465
+ * Sets the year for this date instance plus 1900 considering the configured time zone, see
466
+ * <code>Date.prototype.setYear</code>.
467
+ *
468
+ * @param {int} iYear The year which is to be set for this date plus 1900
469
+ * @returns {int}
470
+ * The milliseconds of the new timestamp based on the UNIX epoch, or <code>NaN</code> if the
471
+ * timestamp could not be updated
472
+ *
473
+ * @deprecated since version 1.111.0 as it is deprecated in JavaScript Date; use
474
+ * {@link #setFullYear} instead
475
+ * @public
476
+ */
477
+ UI5Date.prototype.setYear = function (iYear) {
478
+ return this._setParts(["year"], [(parseInt(iYear) + 1900)]);
479
+ };
480
+
481
+ /**
482
+ * Returns this date object to the given time represented by a number of milliseconds based on the
483
+ * UNIX epoch, see <code>Date.prototype.getTime</code>.
484
+ *
485
+ * @returns {int}
486
+ * The timestamp in milliseconds of this date based on the UNIX epoch, or <code>NaN</code> if
487
+ * the date is an invalid date
488
+ *
489
+ * @function
490
+ * @name module:sap/ui/core/date/UI5Date.prototype.getTime
491
+ * @public
492
+ */
493
+
494
+ /**
495
+ * Returns the day of the month of this date instance according to universal time,
496
+ * see <code>Date.prototype.getUTCDate</code>.
497
+ *
498
+ * @returns {int}
499
+ * A number between 1 and 31 representing the day of the month of this date instance according
500
+ * to universal time
501
+ *
502
+ * @function
503
+ * @name module:sap/ui/core/date/UI5Date.prototype.getUTCDate
504
+ * @public
505
+ */
506
+
507
+ /**
508
+ *
509
+ * Returns the day of the week of this date instance according to universal time,
510
+ * see <code>Date.prototype.getUTCDay</code>.
511
+ *
512
+ * @returns {int}
513
+ * A number between 0 (Sunday) and 6 (Saturday) representing the day of the week of this date
514
+ * instance according to universal time
515
+ *
516
+ * @function
517
+ * @name module:sap/ui/core/date/UI5Date.prototype.getUTCDay
518
+ * @public
519
+ */
520
+
521
+ /**
522
+ * Returns the year of this date instance according to universal time, see
523
+ * <code>Date.prototype.getUTCFullYear</code>.
524
+ *
525
+ * @returns {int} The year of this date instance according to universal time
526
+ *
527
+ * @function
528
+ * @name module:sap/ui/core/date/UI5Date.prototype.getUTCFullYear
529
+ * @public
530
+ */
531
+
532
+ /**
533
+ * Returns the hours of this date instance according to universal time, see
534
+ * <code>Date.prototype.getUTCHours</code>.
535
+ *
536
+ * @returns {int}
537
+ * A number between 0 and 23 representing the hours of this date instance according to
538
+ * universal time
539
+ *
540
+ * @function
541
+ * @name module:sap/ui/core/date/UI5Date.prototype.getUTCHours
542
+ * @public
543
+ */
544
+
545
+ /**
546
+ * Returns the milliseconds of this date instance according to universal time,
547
+ * see <code>Date.prototype.getUTCMilliseconds</code>.
548
+ *
549
+ * @returns {int}
550
+ * A number between 0 and 999 representing the milliseconds of this date instance according to
551
+ * universal time
552
+ *
553
+ * @function
554
+ * @name module:sap/ui/core/date/UI5Date.prototype.getUTCMilliseconds
555
+ * @public
556
+ */
557
+
558
+ /**
559
+ * Returns the minutes of this date instance according to universal time, see
560
+ * <code>Date.prototype.getUTCMinutes</code>.
561
+ *
562
+ * @returns {int}
563
+ * A number between 0 and 59 representing the minutes of this date instance according to
564
+ * universal time
565
+ *
566
+ * @function
567
+ * @name module:sap/ui/core/date/UI5Date.prototype.getUTCMinutes
568
+ * @public
569
+ */
570
+
571
+ /**
572
+ * Returns the month index of this date instance according to universal time, see
573
+ * <code>Date.prototype.getUTCMonth</code>.
574
+ *
575
+ * @returns {int}
576
+ * The month index between 0 (January) and 11 (December) of this date instance according to
577
+ * universal time
578
+ *
579
+ * @function
580
+ * @name module:sap/ui/core/date/UI5Date.prototype.getUTCMonth
581
+ * @public
582
+ */
583
+
584
+ /**
585
+ * Returns the seconds of this date instance according to universal time, see
586
+ * <code>Date.prototype.getUTCSeconds</code>.
587
+ *
588
+ * @returns {int}
589
+ * A number between 0 and 59 representing the seconds of this date instance according to
590
+ * universal time
591
+ *
592
+ * @function
593
+ * @name module:sap/ui/core/date/UI5Date.prototype.getUTCSeconds
594
+ * @public
595
+ */
596
+
597
+ /**
598
+ * Sets the day of the month for this date instance according to universal time,
599
+ * see <code>Date.prototype.setUTCDate</code>.
600
+ *
601
+ * @param {int} iDay
602
+ * An integer representing the new day value, see <code>Date.prototype.setUTCDate</code>
603
+ * @returns {int}
604
+ * The milliseconds of the new timestamp based on the UNIX epoch, or <code>NaN</code> if the
605
+ * timestamp could not be updated
606
+ *
607
+ * @function
608
+ * @name module:sap/ui/core/date/UI5Date.prototype.setUTCDate
609
+ * @public
610
+ */
611
+
612
+ /**
613
+ * Sets the year, month and day for this date instance according to universal time,
614
+ * see <code>Date.prototype.setUTCFullYear</code>.
615
+ *
616
+ * @param {int} iYear An integer representing the new year value
617
+ * @param {int} [iMonth] An integer representing the new month index
618
+ * @param {int} [iDay] An integer representing the new day value
619
+ * @returns {int}
620
+ * The milliseconds of the new timestamp based on the UNIX epoch, or <code>NaN</code> if the
621
+ * timestamp could not be updated
622
+ *
623
+ * @function
624
+ * @name module:sap/ui/core/date/UI5Date.prototype.setUTCFullYear
625
+ * @public
626
+ */
627
+
628
+ /**
629
+ * Sets the hours, minutes, seconds and milliseconds for this date instance according to
630
+ * universal time, see <code>Date.prototype.setUTCHours</code>.
631
+ *
632
+ * @param {int} iHours An integer representing the new hour value
633
+ * @param {int} [iMinutes] An integer representing the new minutes value
634
+ * @param {int} [iSeconds] An integer representing the new seconds value
635
+ * @param {int} [iMilliseconds] An integer representing the new milliseconds value
636
+ * @returns {int}
637
+ * The milliseconds of the new timestamp based on the UNIX epoch, or <code>NaN</code> if the
638
+ * timestamp could not be updated
639
+ *
640
+ * @function
641
+ * @name module:sap/ui/core/date/UI5Date.prototype.setUTCHours
642
+ * @public
643
+ */
644
+
645
+ /**
646
+ * Sets the milliseconds for this date instance according to universal time, see
647
+ * <code>Date.prototype.setUTCMilliseconds</code>.
648
+ *
649
+ * @param {int} iMilliseconds An integer representing the new milliseconds value
650
+ * @returns {int}
651
+ * The milliseconds of the new timestamp based on the UNIX epoch, or <code>NaN</code> if the
652
+ * timestamp could not be updated
653
+ *
654
+ * @function
655
+ * @name module:sap/ui/core/date/UI5Date.prototype.setUTCMilliseconds
656
+ * @public
657
+ */
658
+
659
+ /**
660
+ * Sets the minutes, seconds and milliseconds for this date instance according to universal
661
+ * time, see <code>Date.prototype.setUTCMinutes</code>.
662
+ *
663
+ * @param {int} iMinutes An integer representing the new minutes value
664
+ * @param {int} [iSeconds] An integer representing the new seconds value
665
+ * @param {int} [iMilliseconds] An integer representing the new milliseconds value
666
+ * @returns {int}
667
+ * The milliseconds of the new timestamp based on the UNIX epoch, or <code>NaN</code> if the
668
+ * timestamp could not be updated
669
+ *
670
+ * @function
671
+ * @name module:sap/ui/core/date/UI5Date.prototype.setUTCMinutes
672
+ * @public
673
+ */
674
+
675
+ /**
676
+ * Sets the month and day for this date instance according to universal time,
677
+ * see <code>Date.prototype.setUTCMonth</code>.
678
+ *
679
+ * @param {int} iMonth An integer representing the new month index
680
+ * @param {int} [iDay] An integer representing the new day value
681
+ * @returns {int}
682
+ * The milliseconds of the new timestamp based on the UNIX epoch, or <code>NaN</code> if the
683
+ * timestamp could not be updated
684
+ *
685
+ * @function
686
+ * @name module:sap/ui/core/date/UI5Date.prototype.setUTCMonth
687
+ * @public
688
+ */
689
+
690
+ /**
691
+ * Sets the seconds and milliseconds for this date instance according to universal time,
692
+ * see <code>Date.prototype.setUTCSeconds</code>.
693
+ *
694
+ * @param {int} iSeconds An integer representing the new seconds value
695
+ * @param {int} [iMilliseconds] An integer representing the new milliseconds value
696
+ * @returns {int}
697
+ * The milliseconds of the new timestamp based on the UNIX epoch, or <code>NaN</code> if the
698
+ * timestamp could not be updated
699
+ *
700
+ * @function
701
+ * @name module:sap/ui/core/date/UI5Date.prototype.setUTCSeconds
702
+ * @public
703
+ */
704
+
705
+ /**
706
+ * Converts this date to a string, interpreting it in the UTC time zone, see
707
+ * <code>Date.prototype.toGMTString</code>.
708
+ *
709
+ * @returns {string} The converted date as string in the UTC time zone
710
+ *
711
+ * @function
712
+ * @name module:sap/ui/core/date/UI5Date.prototype.toGMTString
713
+ * @public
714
+ */
715
+
716
+ /**
717
+ * Converts this date to a string in ISO format in the UTC offset zero time zone, as denoted
718
+ * by the suffix <code>Z</code>, see <code>Date.prototype.toISOString</code>.
719
+ *
720
+ * @returns {string}
721
+ * The converted date as a string in ISO format, in the UTC offset zero time zone
722
+ *
723
+ * @function
724
+ * @name module:sap/ui/core/date/UI5Date.prototype.toISOString
725
+ * @public
726
+ */
727
+
728
+ /**
729
+ * Returns a string representation of this date object, see <code>Date.prototype.toJSON</code>.
730
+ *
731
+ * @returns {string} The date object representation as a string
732
+ *
733
+ * @function
734
+ * @name module:sap/ui/core/date/UI5Date.prototype.toJSON
735
+ * @public
736
+ */
737
+
738
+ /**
739
+ * Returns the date portion of this date object interpreted in the configured time zone in
740
+ * English, see <code>Date.prototype.toDateString</code>.
741
+ *
742
+ * @returns {string}
743
+ * The date portion of this date object interpreted in the configured time zone in English
744
+ *
745
+ * @public
746
+ */
747
+ UI5Date.prototype.toDateString = function () {
748
+ if (isNaN(this.oDate)) {
749
+ return this.oDate.toDateString();
750
+ }
751
+
752
+ return aWeekday[this.getDay()] + " " + aMonths[this.getMonth()] + " "
753
+ + addLeadingZeros(this.getDate(), 2) + " " + addLeadingZeros(this.getFullYear(), 4);
754
+ };
755
+
756
+ /**
757
+ * Returns a string with a language-dependent representation of the date part of this date
758
+ * object interpreted by default in the configured time zone, see
759
+ * <code>Date.prototype.toLocaleDateString</code>.
760
+ *
761
+ * @param {string} [sLocale=sap.ui.core.Configuration.getLanguageTag()]
762
+ * The locale used for formatting; the configured locale by default
763
+ * @param {object} [oOptions]
764
+ * The options object used for formatting, corresponding to the options parameter of the
765
+ * <code>Intl.DateTimeFormat</code> constructor
766
+ * @param {string} [oOptions.timeZone=sap.ui.core.Configuration.getTimezone()]
767
+ * The IANA time zone ID; the configured time zone by default
768
+ * @returns {string}
769
+ * The language-dependent representation of the date part of this date object
770
+ *
771
+ * @function
772
+ * @name module:sap/ui/core/date/UI5Date.prototype.toLocaleDateString
773
+ * @public
774
+ */
775
+
776
+ /**
777
+ * Returns a string with a language-dependent representation of this date object interpreted by
778
+ * default in the configured time zone, see <code>Date.prototype.toLocaleString</code>.
779
+ *
780
+ * @param {string} [sLocale=sap.ui.core.Configuration.getLanguageTag()]
781
+ * The locale used for formatting; the configured locale by default
782
+ * @param {object} [oOptions]
783
+ * The options object used for formatting, corresponding to the options parameter of the
784
+ * <code>Intl.DateTimeFormat</code> constructor
785
+ * @param {string} [oOptions.timeZone=sap.ui.core.Configuration.getTimezone()]
786
+ * The IANA time zone ID; the configured time zone by default
787
+ * @returns {string}
788
+ * The language-dependent representation of this date object
789
+ *
790
+ * @function
791
+ * @name module:sap/ui/core/date/UI5Date.prototype.toLocaleString
792
+ * @public
793
+ */
794
+
795
+ /**
796
+ * Returns a string with a language-dependent representation of the time part of this date
797
+ * object interpreted by default in the configured time zone, see
798
+ * <code>Date.prototype.toLocaleTimeString</code>.
799
+ *
800
+ * @param {string} [sLocale=sap.ui.core.Configuration.getLanguageTag()]
801
+ * The locale used for formatting; the configured locale by default
802
+ * @param {object} [oOptions]
803
+ * The options object used for formatting, corresponding to the options parameter of the
804
+ * <code>Intl.DateTimeFormat</code> constructor
805
+ * @param {string} [oOptions.timeZone=sap.ui.core.Configuration.getTimezone()]
806
+ * The IANA time zone ID; the configured time zone by default
807
+ * @returns {string}
808
+ * The language-dependent representation of the time part of this date object
809
+ *
810
+ * @function
811
+ * @name module:sap/ui/core/date/UI5Date.prototype.toLocaleTimeString
812
+ * @public
813
+ */
814
+
815
+ /**
816
+ * Returns a string representing this date object interpreted in the configured time zone.
817
+ *
818
+ * @returns {string}
819
+ * A string representing this date object interpreted in the configured time zone
820
+ *
821
+ * @public
822
+ */
823
+ UI5Date.prototype.toString = function () {
824
+ if (isNaN(this.oDate)) {
825
+ return this.oDate.toString();
826
+ }
827
+
828
+ return this.toDateString() + " " + this.toTimeString();
829
+ };
830
+
831
+ /**
832
+ * Returns the time portion of this date object interpreted in the configured time zone in English.
833
+ *
834
+ * @returns {string}
835
+ * The time portion of this date object interpreted in the configured time zone in English
836
+ *
837
+ * @public
838
+ */
839
+ UI5Date.prototype.toTimeString = function () {
840
+ var iHours, iMinutes, sSign, iTimeZoneOffset;
841
+ if (isNaN(this.oDate)) {
842
+ return this.oDate.toTimeString();
843
+ }
844
+ iTimeZoneOffset = this.getTimezoneOffset();
845
+ sSign = iTimeZoneOffset > 0 ? "-" : "+";
846
+ iHours = Math.floor(Math.abs(iTimeZoneOffset) / 60);
847
+ iMinutes = Math.abs(iTimeZoneOffset) % 60;
848
+
849
+ // ommit the optional, implementation dependent time zone name
850
+ return addLeadingZeros(this.getHours(), 2) + ":" + addLeadingZeros(this.getMinutes(), 2)
851
+ + ":" + addLeadingZeros(this.getSeconds(), 2) + " GMT" + sSign
852
+ + addLeadingZeros(iHours, 2) + addLeadingZeros(iMinutes, 2);
853
+ };
854
+
855
+ /**
856
+ * Converts this date to a string, interpreting it in the UTC time zone, see
857
+ * <code>Date.prototype.toUTCString</code>.
858
+ *
859
+ * @returns {string} The converted date as a string in the UTC time zone
860
+ *
861
+ * @function
862
+ * @name module:sap/ui/core/date/UI5Date.prototype.toUTCString
863
+ * @public
864
+ */
865
+
866
+ /**
867
+ * Returns the value of this date object in milliseconds based on the UNIX epoch, see
868
+ * <code>Date.prototype.valueOf</code>.
869
+ *
870
+ * @returns {int} The primitive value of this date object in milliseconds based on the UNIX epoch
871
+ *
872
+ * @function
873
+ * @name module:sap/ui/core/date/UI5Date.prototype.valueOf
874
+ * @public
875
+ */
876
+
877
+ // functions that simply delegate to the inner date instance
878
+ [
879
+ "getTime", "getUTCDate", "getUTCDay", "getUTCFullYear", "getUTCHours", "getUTCMilliseconds",
880
+ "getUTCMinutes", "getUTCMonth", "getUTCSeconds",
881
+ "setUTCDate", "setUTCFullYear", "setUTCHours", "setUTCMilliseconds", "setUTCMinutes",
882
+ "setUTCMonth", "setUTCSeconds",
883
+ "toGMTString", "toISOString", "toJSON", "toUTCString", "valueOf"
884
+ ].forEach(function (sMethod) {
885
+ UI5Date.prototype[sMethod] = function () {
886
+ return this.oDate[sMethod].apply(this.oDate, arguments);
887
+ };
888
+ });
889
+
890
+ ["toLocaleDateString", "toLocaleString", "toLocaleTimeString"].forEach(function (sMethod) {
891
+ UI5Date.prototype[sMethod] = function (sLocale, oOptions) {
892
+ return this.oDate[sMethod](sLocale || Configuration.getLanguageTag(),
893
+ Object.assign({timeZone: this.sTimezoneID}, oOptions));
894
+ };
895
+ });
896
+
897
+ /**
898
+ * Creates a JavaScript Date instance.
899
+ *
900
+ * @param {object} vParts
901
+ * The <code>arguments</code> object which is given to
902
+ * <code>module:sap/ui/core/date/UI5Date.getInstance</code>
903
+ * @returns {Date}
904
+ * A JavaScript Date instance
905
+ *
906
+ * @private
907
+ */
908
+ UI5Date._createDateInstance = function (vParts) {
909
+ if (vParts[0] instanceof Date) {
910
+ vParts[0] = vParts[0].valueOf();
911
+ }
912
+
913
+ // ES5 variant of new Date(...vParts)
914
+ return new (Function.prototype.bind.apply(Date, [].concat.apply([null], vParts)))();
915
+ };
916
+
917
+ /**
918
+ * Creates a date instance (either JavaScript Date or <code>UI5Date</code>) which considers the
919
+ * configured time zone wherever JavaScript Date uses the local browser time zone, for example
920
+ * in <code>getDate</code>, <code>toString</code>, or <code>setHours</code>. The supported
921
+ * parameters are the same as the ones supported by the JavaScript Date constructor.
922
+ *
923
+ * @param {int|string|Date|module:sap/ui/core/date/UI5Date|null} [vYearOrValue]
924
+ * Same meaning as in the JavaScript Date constructor
925
+ * @param {int|string} [vMonthIndex]
926
+ * Same meaning as in the JavaScript Date constructor
927
+ * @param {int|string} [vDay=1] Same meaning as in the Date constructor
928
+ * @param {int|string} [vHours=0] Same meaning as in the Date constructor
929
+ * @param {int|string} [vMinutes=0] Same meaning as in the Date constructor
930
+ * @param {int|string} [vSeconds=0] Same meaning as in the Date constructor
931
+ * @param {int|string} [vMilliseconds=0] Same meaning as in the Date constructor
932
+ * @returns {Date|module:sap/ui/core/date/UI5Date}
933
+ * The date instance that considers the configured time zone in all local getters and setters.
934
+ *
935
+ * @public
936
+ * @see sap.ui.core.Configuration.getTimezone
937
+ */
938
+ UI5Date.getInstance = function () {
939
+ var sTimezone = Configuration.getTimezone();
940
+
941
+ if (sTimezone !== TimezoneUtil.getLocalTimezone()) {
942
+ return new UI5Date(arguments, sTimezone);
943
+ }
944
+ // time zones are equal -> use JavaScript Date as it is
945
+ return UI5Date._createDateInstance(arguments);
946
+ };
947
+
948
+ /**
949
+ * Checks whether the given date object is a valid date, considers the configured time zone
950
+ * and throws an error otherwise.
951
+ *
952
+ * @param {Date|module:sap/ui/core/date/UI5Date} oDate
953
+ * The date object created via <code>UI5Date.getInstance</code>
954
+ * @throws {Error}
955
+ * If the given date object is not valid or does not consider the configured time zone
956
+ *
957
+ * @private
958
+ */
959
+ UI5Date.checkDate = function (oDate) {
960
+ if (isNaN(oDate.getTime())) {
961
+ throw new Error("The given Date is not valid");
962
+ }
963
+ if (!(oDate instanceof UI5Date) && (Configuration.getTimezone() !== TimezoneUtil.getLocalTimezone())) {
964
+ throw new Error("Configured time zone requires the parameter 'oDate' to be an instance of"
965
+ + " sap.ui.core.date.UI5Date");
966
+ }
967
+ };
968
+
969
+ return UI5Date;
970
+ });