Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

%k failure at midnight #5

Open
dirkf opened this issue Sep 17, 2020 · 0 comments
Open

%k failure at midnight #5

dirkf opened this issue Sep 17, 2020 · 0 comments

Comments

@dirkf
Copy link

dirkf commented Sep 17, 2020

The %k format can escape if nHour === 0 as 0 || '' => ''. It needs to be stringified. This is a simple fix:
#4

But maybe there are other formats where this applies? Any format expression that returns a number that could be 0, '' or any other falsy value needs to be stringified.

Instead why not have

 function(sMatch) {
            var fmt={
                '%a': aDays[nDay].slice(0,3),
                ...
                '%Z': date.toTimeString().replace(/.+\((.+?)\)$/, '$1')
            }[sMatch];
            if (typeof(fmt) === undefined) fmt = sMatch;
            return fmt +'';
        }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant