Skip to content

Commit

Permalink
Date: Fix dateFormatter (add missing fix on extract-visitors)
Browse files Browse the repository at this point in the history
  • Loading branch information
rxaviers committed May 18, 2017
1 parent b4111cd commit bd1beee
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ module.exports = {
node.callee.object.name === "Globalize" &&
node.callee.property.type === Syntax.Identifier && (
node.callee.property.name === "currencyFormatter" ||
node.callee.property.name === "dateToPartsFormatter" ||
node.callee.property.name === "dateFormatter" ||
node.callee.property.name === "dateParser" ||
node.callee.property.name === "dateToPartsFormatter" ||
node.callee.property.name === "numberFormatter" ||
node.callee.property.name === "numberParser" ||
node.callee.property.name === "pluralGenerator" ||
Expand Down
6 changes: 6 additions & 0 deletions test/functional/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ var expect = require("chai").expect;
Globalize.locale("en");

describe("The compiled `basic.js`", function() {
it("should include dateFormatter", function() {
var result = Globalize.dateFormatter({time: "medium"})(new Date(2017, 3, 15, 12, 31, 45));
// Note, the reason for the loose match below is due to ignore the local time zone differences.
expect(result).to.have.string("31:45");
});

it("should include formatDate", function() {
var result = Globalize.formatDate(new Date(2017, 3, 15), {date: "medium"});
// Note, the reason for the loose match below is due to ignore the local time zone differences.
Expand Down
3 changes: 3 additions & 0 deletions test/unit/fixtures/basic.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ var like;
var Globalize = require( "globalize" );

// Use Globalize to format dates.
var dateFormatter = Globalize.dateFormatter( { time: "medium" } );
console.log( dateFormatter( new Date() ) );

console.log( Globalize.formatDate( new Date(), { date: "medium" } ) );

// Use Globalize to format dates to parts.
Expand Down

0 comments on commit bd1beee

Please sign in to comment.