Issue
Symptoms
While using date picker with the date / date time fields on service portal, getting below javascript error,
moment-timezone-with-data.js:476 zone.offset has been deprecated in favor of zone.utcOffset
Complete error stack is shown in below screenshot,
Release
Any supported release.
Cause
Older version of moment.js third party library (/ajax/libs/moment.js/2.22.2/moment.min.js) was included in the out of the box provided "moment.js" widget dependency (https://InstanceName.service-now.com/nav_to.do?uri=sp_dependency.do?sys_id=db6689c1cb11120000f8d856634c9c3b).
Hence system loads the older version of moment.js in DOM and eventually we get the error "zone.offset has been deprecated in favor of zone.utcOffset" while accessing date /date time field since older version of moment.js library has deprecated methods.
Resolution
Out of the box provided moment.js widget dependency has following definition,
Name = moment
Application = Global
Included on Page load = false
JS Includes,
order = 200, JS Include = /scripts/thirdparty/moment-timezone-0.4.0/moment-timezone-utils.js, JS file URL = /scripts/thirdparty/moment-timezone-0.4.0/moment-timezone-utils.js
order = 200, JS Include = /scripts/thirdparty/moment-jdateformatparser-1.0.2/moment-jdateformatparser.js, JS file URL = /scripts/thirdparty/moment-jdateformatparser-1.0.2/moment-jdateformatparser.js
Hence, we recommend, updating your "moment.js" widget dependency as per the out of the box definition
OR
Keep the out of the box provided version and delete the custom moment.js widget dependency.