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

dateFormatter with raw pattern isn't handling two single quotes correctly when outside quoted text #822

Open
jonathan-saunders-ge opened this issue Apr 16, 2018 · 1 comment

Comments

@jonathan-saunders-ge
Copy link

Thanks for this great package! :-)

The LDML spec says: "Two adjacent single vertical quotes (''), which represent a literal single quote, either inside or outside quoted text."

However globalize.dateFormatter({raw: "h''m''s''"}) returns "456" instead of "4'5'6'".

I ran this over at https://npm.runkit.com/globalize

var Globalize = require("globalize")
Globalize.load( require( "cldr-data" ).entireSupplemental() );
Globalize.load( require( "cldr-data" ).entireMainFor( "en" ) );
Globalize.loadTimeZone( require( "iana-tz-data" ) );
var globalize = Globalize( "en" ),
    date = new Date( 2001, 2-1, 3, 4, 5, 6, 789 );
var check = function (fmt) {
    console.log(fmt + '    ==>    ' + globalize.dateFormatter({raw: fmt})(date));
};
check("h''m''s''"); // fails, expect 4'5'6' but get 456
check("'h''m''s'''"); // works, expect h'm's'
check("h''''m''''s"); // fails, expect 4'5'6 (or 4''5''6, unclear from spec?) but get 456
@rxaviers
Copy link
Member

Thank you for reporting this bug, yeap this should work as you say

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants