Skip to content

Commit bd1beee

Browse files
committed
Date: Fix dateFormatter (add missing fix on extract-visitors)
Amends b82d954 Ref globalizejs#24
1 parent b4111cd commit bd1beee

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

lib/extract-visitors/global-various-formatters-and-parsers.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@ module.exports = {
1111
node.callee.object.name === "Globalize" &&
1212
node.callee.property.type === Syntax.Identifier && (
1313
node.callee.property.name === "currencyFormatter" ||
14-
node.callee.property.name === "dateToPartsFormatter" ||
14+
node.callee.property.name === "dateFormatter" ||
1515
node.callee.property.name === "dateParser" ||
16+
node.callee.property.name === "dateToPartsFormatter" ||
1617
node.callee.property.name === "numberFormatter" ||
1718
node.callee.property.name === "numberParser" ||
1819
node.callee.property.name === "pluralGenerator" ||

test/functional/index.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@ var expect = require("chai").expect;
33
Globalize.locale("en");
44

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

test/unit/fixtures/basic.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ var like;
22
var Globalize = require( "globalize" );
33

44
// Use Globalize to format dates.
5+
var dateFormatter = Globalize.dateFormatter( { time: "medium" } );
6+
console.log( dateFormatter( new Date() ) );
7+
58
console.log( Globalize.formatDate( new Date(), { date: "medium" } ) );
69

710
// Use Globalize to format dates to parts.

0 commit comments

Comments
 (0)