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

toString with only 's' or 'm' fails #259

Open
coreygeesey opened this issue Oct 14, 2016 · 0 comments
Open

toString with only 's' or 'm' fails #259

coreygeesey opened this issue Oct 14, 2016 · 0 comments
Labels

Comments

@coreygeesey
Copy link

coreygeesey commented Oct 14, 2016

require('datejs');

var format1 = "s";
var format2 = "ss";
var format3 = "hh:mm:s"

var myDate = new Date();

console.log("One s: "+myDate.toString(format1));
console.log("Two s: "+myDate.toString(format2));
console.log("Formatted hh:mm:s: "+myDate.toString(format3));

Results are:
[coreyivr]# node myDate.js
One s: 2016-10-14T09:59:21
Two s: 21
Formatted hh:mm:s: 09:59:21

It's an easy enough fix in my code (just use ss and strip the zero if there is one), but it would be nice to get this fixed in the library.

edit:

A similar situation arises with just one m as well.

require('datejs');

var format1 = "m";
var format2 = "mm";
var format3 = "hh:m:s"

var myDate = Date.parse("October 14th, 2016 10:03 PM");

console.log("One m: "+myDate.toString(format1));
console.log("Two m: "+myDate.toString(format2));
console.log("Formatted hh:m:s: "+myDate.toString(format3));

Results:
One m: October 14
Two m: 03
Formatted hh:m:s: 10:3:0

@coreygeesey coreygeesey changed the title toString with only 's' fails toString with only 's' or 'm' fails Oct 14, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants