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

Date: Olson-timezone-support (real 'z', 'v', 'V') and options.timeZone #701

Closed
wants to merge 2 commits into from

Conversation

rxaviers
Copy link
Member

@rxaviers rxaviers commented Mar 8, 2017

Checklist:

  • Normal Code
  • Unit tests
    • test/unit/date/format.js
    • test/unit/date/format-properties.js
  • Functional tests
    • Test options.timeZone
  • Runtime code
  • Documentation
    • options.timeZone
  • Examples
    • Add options.timeZone
  • Use external zoned-date-time module

Notes:

@rxaviers
Copy link
Member Author

rxaviers commented Mar 14, 2017

The below is wrong, it should use "British Summer Time" name instead.

Globalize('en-GB').formatDate(new Date(2017,8,1), {datetime: 'full', timeZone: 'Europe/London'})
'Friday, 1 September 2017 at 04:00:00 GMT+01:00'

Edit: this has been fixed.

@jsf-clabot
Copy link

jsf-clabot commented Mar 14, 2017

CLA assistant check
All committers have signed the CLA.

@rxaviers rxaviers modified the milestone: 1.3.0 Mar 17, 2017
@rxaviers rxaviers force-pushed the timezone branch 5 times, most recently from 7cb9891 to c82a6d0 Compare March 17, 2017 14:45
@rxaviers
Copy link
Member Author

To quickly demo what's coming... I hope you like it!

npm install globalize@1.3.0-alpha.0 cldr-data iana-tz-data
var Globalize = require( "globalize" );
Globalize.load( require( "cldr-data" ).entireSupplemental() );
Globalize.load( require( "cldr-data" ).entireMainFor( "en" ) );
Globalize.loadIANATimezone( require( "iana-tz-data" ) );

Globalize( "en" ).formatDate(new Date(), {datetime: "short", timeZone: "America/Los_Angeles"});
// > '3/19/17, 3:19 PM'
Globalize( "en" ).formatDate(new Date(), {datetime: "short", timeZone: "America/New_York"});
// > '3/19/17, 6:19 PM'
Globalize( "en" ).formatDate(new Date(), {datetime: "short", timeZone: "America/Sao_Paulo"});
// > '3/19/17, 7:19 PM'
Globalize( "en" ).formatDate(new Date(), {datetime: "short", timeZone: "Europe/Berlin"});
// > '3/19/17, 11:19 PM'

Globalize( "en" ).formatDate(new Date(), {datetime: "full", timeZone: "America/Los_Angeles"});
// > 'Sunday, March 19, 2017 at 3:19:22 PM Pacific Daylight Time'
Globalize( "en" ).formatDate(new Date(), {datetime: "full", timeZone: "America/New_York"});
// > 'Sunday, March 19, 2017 at 6:19:22 PM Eastern Daylight Time'
Globalize( "en" ).formatDate(new Date(), {datetime: "full", timeZone: "America/Sao_Paulo"});
// > 'Sunday, March 19, 2017 at 7:19:22 PM Brasilia Standard Time'
Globalize( "en" ).formatDate(new Date(), {datetime: "full", timeZone: "Europe/Berlin"});
// > 'Sunday, March 19, 2017 at 11:19:53 PM Central European Standard Time'

@mattyork
Copy link
Contributor

@rxaviers I LOVE YOU. We need this.

rxaviers pushed a commit to rxaviers/zoned-date-time that referenced this pull request Mar 30, 2017
rxaviers added a commit to rxaviers/zoned-date-time that referenced this pull request Mar 30, 2017
rxaviers pushed a commit to rxaviers/zoned-date-time that referenced this pull request Apr 3, 2017
rxaviers added a commit to rxaviers/zoned-date-time that referenced this pull request Apr 3, 2017
rxaviers added a commit to rxaviers/zoned-date-time that referenced this pull request Apr 6, 2017
@rxaviers rxaviers force-pushed the timezone branch 2 times, most recently from 5ba59fe to e3d4838 Compare April 13, 2017 04:28
@mattyork
Copy link
Contributor

Any updates on this? We need to add support for timezones in the next few weeks.

@mattyork
Copy link
Contributor

mattyork commented May 1, 2017

Globalize compiler isn't working with the alpha. Versions used:

    "globalize": "1.3.0-alpha.3",
    "globalize-compiler": "0.3.0-alpha.3",
    "iana-tz-data": "2017.1.0",

Here's the script that's failing:

const ianaTzData = require('iana-tz-data');
const Globalize = require("globalize");
const cldrData = require('./vendor/cldr-data.json');
Globalize.loadIANATimeZone(ianaTzData);
Globalize.load(cldrData);
Globalize.locale("en");

const date = new Date();
const d1 = Globalize.dateFormatter({ datetime: "full" })
console.log(d1(date))

const globalizeCompiler = require('globalize-compiler');

const out = globalizeCompiler.compile([d1])

It fails here in the globalize compiler, failing to extract the formatter because it doesn't have the runtimeArgs.
image

@rxaviers
Copy link
Member Author

rxaviers commented May 3, 2017

Hi @mattyork, we should have a 1.3.0 soon.

About the issue above, Thanks for reporting it.

@rxaviers
Copy link
Member Author

For the record, the fix for the dateFormatter runtime issue is here: #724

@rxaviers
Copy link
Member Author

Rebased and squashed

@rxaviers
Copy link
Member Author

Merged 🕺

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

Successfully merging this pull request may close these issues.

4 participants