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

changes for timeInterval #6493

Merged
merged 7 commits into from
Apr 30, 2018
Merged

changes for timeInterval #6493

merged 7 commits into from
Apr 30, 2018

Conversation

hanbollar
Copy link

Fixes #6164

@cesium-concierge
Copy link

Signed CLA is on file.

@hanbollar, thanks for the pull request! Maintainers, we have a signed CLA from @hanbollar, so you can review this at any time.


I am a bot who helps you make Cesium awesome! Contributions to my configuration are welcome.

🌍 🌎 🌏

@hanbollar
Copy link
Author

@hpinkos I updated the documentation and added in the throw statement. lmk if this is what you were looking for / if there's anything else you think I should do.

@mramato
Copy link
Contributor

mramato commented Apr 25, 2018

I don't think this change is necessary, There are way more rules to an ISO8601 interval than containing a slash and the doc already links to the spec.

@mramato
Copy link
Contributor

mramato commented Apr 25, 2018

Actually, looking at the code some more this should do some extra validation. After var dates = options.iso8601.split('/'); it should check if dates.length is equal to 2 and throw a new DeveloperError('Invalid ISO 8601 date.'), this will match the rest of date parsing as done in JulianDate.fromIso8601.

@hanbollar
Copy link
Author

@mramato updated to match that

@ggetz
Copy link
Contributor

ggetz commented Apr 27, 2018

Thanks @hanbollar, can you add a quick test as well?

@hanbollar
Copy link
Author

@ggetz added

@@ -100,6 +100,12 @@ defineSuite([
expect(interval.data).toEqual(data);
});

it('fromIso8601 throws error when given Invalid ISO 8601 date.', function() {
expect(function() {
expect(TimeInterval.fromIso8601({ iso8601 : '2020-08-29T00:00:00+00:00' }));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't need to wrap this in the second expect:

expect(function() {
    TimeInterval.fromIso8601({ iso8601 : '2020-08-29T00:00:00+00:00' });
});

@hanbollar
Copy link
Author

@ggetz removed second expect

@ggetz
Copy link
Contributor

ggetz commented Apr 30, 2018

Thanks @hanbollar !

@@ -143,6 +147,9 @@ define([
//>>includeEnd('debug');

var dates = options.iso8601.split('/');
if (dates.length !== 2) {
throw new DeveloperError('Invalid ISO 8601 date.');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

options.iso8601 is an invalid ISO 8601 interval

@hpinkos hpinkos merged commit f2e3d2e into CesiumGS:master Apr 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants