Discussions
Stay up-to-date with the latest news from NetSuite. You’ll be in the know about how to connect with peers and take your business to new heights at our virtual, in-person, on demand events, and much more.
New AI Community Guidelines. Please review and follow them to ensure AI use stays safe, accurate, and compliant.
Please note that on Saturday, April 11, 2026, at 8:00 PM Pacific time, our Case Management System will undergo a scheduled maintenance for approximately 30 minutes. During this time, case creation via SuiteAnswers will be unavailable and inbound calls will be routed to Customer Service.
getTimezoneOffset() of Date Object
The following block doesn't work as we expected.
function getNonDstTimeZoneOffset(date) {
const january1st = new Date(date.getFullYear(), 0, 1)
const july1st = new Date(date.getFullYear(), 6, 1)
return Math.max(january1st.getTimezoneOffset(), july1st.getTimezoneOffset())
}
//january1st.getTimezoneOffset() = 480 (should be -540...)
//july1st.getTimezoneOffset() = 420 (should be -480? though we don't have DST...)
function resetDateWithCurrentTimeZone(utcDate) {
if (!utcDate) {
utcDate = new Date()
//EX) "2023-11-20T07:03:29.492Z"
}
const timezoneOffset = utcDate.getTimezoneOffset()
const nonDstTimezoneOffset = getNonDstTimeZoneOffset(utcDate)
log.audit("==UTCDate & LocalOffset==", {
utcDate: utcDate,
Tagged:
0