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
base: master
from

Conversation

Projects
None yet
4 participants
@rxaviers
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

This comment has been minimized.

Show comment
Hide comment
@rxaviers

rxaviers Mar 14, 2017

Member

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.

Member

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

This comment has been minimized.

Show comment
Hide comment
@jsf-clabot

jsf-clabot Mar 14, 2017

CLA assistant check
All committers have signed the CLA.

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

This comment has been minimized.

Show comment
Hide comment
@rxaviers

rxaviers Mar 19, 2017

Member

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'
Member

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

This comment has been minimized.

Show comment
Hide comment
@mattyork

mattyork Mar 22, 2017

Contributor

@rxaviers I LOVE YOU. We need this.

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

@mattyork

This comment has been minimized.

Show comment
Hide comment
@mattyork

mattyork Apr 29, 2017

Contributor

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

Contributor

mattyork commented Apr 29, 2017

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

@mattyork

This comment has been minimized.

Show comment
Hide comment
@mattyork

mattyork May 1, 2017

Contributor

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

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

This comment has been minimized.

Show comment
Hide comment
@rxaviers

rxaviers May 3, 2017

Member

Hi @mattyork, we should have a 1.3.0 soon.

About the issue above, Thanks for reporting it.

Member

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

@rxaviers

This comment has been minimized.

Show comment
Hide comment
@rxaviers

rxaviers May 17, 2017

Member

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

Member

rxaviers commented May 17, 2017

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

@rxaviers

This comment has been minimized.

Show comment
Hide comment
@rxaviers

rxaviers May 17, 2017

Member

Rebased and squashed

Member

rxaviers commented May 17, 2017

Rebased and squashed

@rxaviers rxaviers closed this in 4fcd2fe May 18, 2017

@rxaviers

This comment has been minimized.

Show comment
Hide comment
@rxaviers

rxaviers May 18, 2017

Member

Merged 🕺

Member

rxaviers commented May 18, 2017

Merged 🕺

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