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

DateFormat time zones unimplemented #10732

Closed
DartBot opened this issue May 20, 2013 · 13 comments
Closed

DateFormat time zones unimplemented #10732

DartBot opened this issue May 20, 2013 · 13 comments
Labels
area-pkg Used for miscellaneous pkg/ packages not associated with specific area- teams. type-enhancement A request for a change that isn't a bug

Comments

@DartBot
Copy link

DartBot commented May 20, 2013

This issue was originally filed by [email protected]


main() {
 var df = new DateFormat("EEE, d MMM yyyy HH:mm:ss z");
  var date = df.parse("Tue, 15 Nov 1994 08:12:31 PST");
  print (df.format(date)); // throws exception
}

@anders-sandholm
Copy link
Contributor

cc @floitschG.
Added Area-Library, Library-Core, Triaged labels.

@floitschG
Copy link
Contributor

cc @alan-knight.
Removed Library-Core label.

@alan-knight
Copy link
Contributor

It's arguably related to core, since DateTime does not store a time zone, which makes it hard to format one. Is the point of this bug that time zone should be recorded and printed, or that you'd rather just have a time zone in a format specification ignored rather than throwing an UnimplementedError?

@DartBot
Copy link
Author

DartBot commented May 21, 2013

This comment was originally written by [email protected]


My goal is to able to parse and format HTTP date strings with DateFormat. I would expect parse() to generate a correct Date object based upon the TZ in the in the source string as a UTC Date. Regarding format(), I would expect the resulting output a valid date string using GMT as the timezone.

Of course ideally, DateTime would be updated to include TZ as well.

@alan-knight
Copy link
Contributor

I think DateTime.parse() might be a better API for reading a format that isn't internationalized. It appears that JavaScript's Date.parse() does read dates in this format. However, the Dart DateTime.parse doesn't use that, and reads in "a subset of ISO 8601" which isn't defined.

Part of the reason timezones are unimplemented right now is that to read and correctly interpret a timezone, particularly by name, requires a great deal of data to be downloaded to a client, and we're reluctant to do that. Having just the information to read RFC822 dates wouldn't be that much, but it seems rather odd for an internationalization library to be able to read time zones, but only US ones, and only in English.

@alan-knight
Copy link
Contributor

Changed the title to: "DateFormat time zones unimplemented".

@floitschG
Copy link
Contributor

Fwiw issue #1878 tracks the planned improvements to DateTime.parse.

@lrhn
Copy link
Member

lrhn commented Apr 24, 2014

I don't think we are expecting to add more time zone names to be recognized by DateTime.parse, so "PST" is probably not going to work, even if the input was formatted as DateTime.parse expected.
This seems to be something that a specialized Date parsing package should handle.


Added Library-Core label.

@sgjesse
Copy link
Contributor

sgjesse commented Apr 30, 2014

No plans to add timezone to DateTime.


Removed Area-Library, Library-Core labels.
Added Area-Pkg, Pkg-Intl labels.

@alan-knight
Copy link
Contributor

Removed Type-Defect label.
Added Type-Enhancement label.

@tlarsen4google
Copy link

If DateTime.timeZoneName works (it produces, e.g. "CDT") in a dart:html application (compiled to Javascript even), why not at least the single "z" in DateFormat?

@alan-knight
Copy link
Contributor

For one thing, people might reasonably expect that

   f.parse(f.format(aDate)) == aDate

which would not be true if we included a time zone.

@DartBot DartBot added Type-Enhancement area-pkg Used for miscellaneous pkg/ packages not associated with specific area- teams. labels May 21, 2014
@DartBot
Copy link
Author

DartBot commented Jun 5, 2015

This issue has been moved to dart-lang/i18n#330.

@DartBot DartBot closed this as completed Jun 5, 2015
@kevmoo kevmoo added type-enhancement A request for a change that isn't a bug and removed triaged labels Mar 1, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-pkg Used for miscellaneous pkg/ packages not associated with specific area- teams. type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

8 participants