%P does not seem to work
nodesocket opened this issue · 5 comments
Using %P
modifier for am
or pm
in lowercase and getting just P
.
I cannot reproduce this. Are you using a locale? The test suite passes and this is covered, and I just tried it in node and it works for me. If you can provide a test case that would help a lot.
[ 3:01pm] ~/Dropbox/Projects/strftime:master % node
> s=require('./strftime')
{ [Function: strftime]
strftime: [Circular],
strftimeUTC: [Function: strftimeUTC],
localizedStrftime: [Function: localizedStrftime] }
> s('%P')
'pm'
> s('%p')
'PM'
Here is the case that breaks:
Date.parseISO8601('2013-05-07T21:45:30.647854Z').strftime('%P');
That must be from another project. Are you using another date library? This project does not extend Date.prototype and there is no Date.parseISO8601 method in node itself.
Let me know if this fails:
var d = Date.parseISO8601('2013-05-07T21:45:30.647854Z');
var strftime = require('strftime');
console.log(strftime('%P', d));
So using %p
, capital AM, PM works, that is fine for now. It is probably something with the parseISO8601 library causing the issue.
If there's a straightforward (and not hacky) way for strftime to work with such dates I am open to changing things to make it easier to integrate the 2 libraries. Let me know.