Recently, I had to debug an error caused by a Javascript condition:
if (utcOffset) {
// do fancy things
}
The problem with utcOffset
param is that i can be a 0
value.
Unfortunatley, there is no better way to solve this than using the following condition:
if (utcOffset !== undefined && utcOffset !== null) {
// do fancy things
}
This way a 0
value will be passing the condition.