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 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 rxaviers mentioned this pull request Mar 8, 2017
5 of 11 tasks complete
@rxaviers rxaviers force-pushed the rxaviers:timezone branch from 1845b8a to d39b374 Mar 10, 2017
@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.

@rxaviers rxaviers force-pushed the rxaviers:timezone branch from 0f46b44 to 7f2a223 Mar 14, 2017
@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 rxaviers:timezone branch 5 times, most recently from 7cb9891 to c82a6d0 Mar 17, 2017
@rxaviers
Copy link
Member Author

rxaviers commented Mar 19, 2017

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

mattyork commented Mar 22, 2017

@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 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 3, 2017
rxaviers added a commit to rxaviers/zoned-date-time that referenced this pull request Apr 6, 2017
@rxaviers rxaviers force-pushed the rxaviers:timezone branch 2 times, most recently from 5ba59fe to e3d4838 Apr 7, 2017
@mattyork
Copy link
Contributor

mattyork commented Apr 29, 2017

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 referenced this pull request May 15, 2017
runtime support
@rxaviers rxaviers force-pushed the rxaviers:timezone branch from 73ec6cc to b4e2b4c May 17, 2017
@rxaviers
Copy link
Member Author

rxaviers commented May 17, 2017

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

@rxaviers rxaviers force-pushed the rxaviers:timezone branch from b4e2b4c to 4a5c59e May 17, 2017
@rxaviers
Copy link
Member Author

rxaviers commented May 17, 2017

Rebased and squashed

@rxaviers rxaviers force-pushed the rxaviers:timezone branch from 788a4b8 to d747d7b May 18, 2017
@rxaviers rxaviers closed this in 4fcd2fe May 18, 2017
@rxaviers
Copy link
Member Author

rxaviers commented May 18, 2017

Merged 🕺

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

Successfully merging this pull request may close these issues.

None yet

4 participants
You can’t perform that action at this time.