Skip to content

It should throw an error when passed empty string as timezone when using moment().tz('') #1044

@shenxiang11

Description

@shenxiang11

Moment-timezone version which you use:

Version: latest

Note: many issues are resolved if you just upgrade to the latest version

Issue description:

The function returns undefined, it's not conform to the interface in index.d.js.
I think it should change themoment.Moment to moment.Moment | undefined
or throw an error like we pass a timezone which is not exist?

interface Moment {
        tz(): string | undefined;
        tz(timezone: string, keepLocalTime?: boolean): moment.Moment; // or should be moment.Moment | undefined ?
        zoneAbbr(): string;
        zoneName(): string;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions