Skip to content

Commit

Permalink
Use ISO8601 date format everywhere (kubernetes#1478)
Browse files Browse the repository at this point in the history
* Use ISO8601 date format everywhere

* Fix format date tests

* clang-format the tests
  • Loading branch information
mrwacky42 authored and bryk committed Nov 28, 2016
1 parent f5f7bcb commit f29313b
Show file tree
Hide file tree
Showing 30 changed files with 42 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,5 @@
</kd-info-card-entry>

<kd-info-card-entry title="[[Creation time|Label 'Creation time' for a resource.]]">
{{::$ctrl.objectMeta.creationTimestamp | date:'medium':'UTC'}}
{{::$ctrl.objectMeta.creationTimestamp | date:'yyyy-MM-ddTHH:mm':'UTC'}}
</kd-info-card-entry>
2 changes: 1 addition & 1 deletion src/app/frontend/configmaplist/configmapcard_component.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export default class ConfigMapCardController {
* @return {string} localized tooltip with the formated creation date
*/
getCreatedAtTooltip(creationDate) {
let filter = this.interpolate_(`{{date | date:'short'}}`);
let filter = this.interpolate_(`{{date | date:'yyyy-MM-ddTHH:mm':'UTC'}}`);
/** @type {string} @desc Tooltip 'Created at [some date]' showing the exact creation time of
* config map. */
let MSG_CONFIG_MAP_LIST_CREATED_AT_TOOLTIP =
Expand Down
2 changes: 1 addition & 1 deletion src/app/frontend/daemonsetlist/daemonsetcard_component.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export class DaemonSetCardController {
* @return {string} localized tooltip with the formatted creation date
*/
getCreatedAtTooltip() {
let filter = this.interpolate_(`{{date | date:'short'}}`);
let filter = this.interpolate_(`{{date | date:'yyyy-MM-ddTHH:mm':'UTC'}}`);
/** @type {string} @desc Tooltip 'Created at [some date]' showing the exact creation time of
* the daemon set.*/
let MSG_DAEMON_SET_LIST_CREATED_AT_TOOLTIP = goog.getMsg(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export default class DeploymentCardController {
* @return {string} localized tooltip with the formatted creation date
*/
getCreatedAtTooltip(creationDate) {
let filter = this.interpolate_(`{{date | date:'short'}}`);
let filter = this.interpolate_(`{{date | date:'yyyy-MM-ddTHH:mm':'UTC'}}`);
/** @type {string} @desc Tooltip 'Created at [some date]' showing the exact creation time of
* a deployment. */
let MSG_DEPLOYMENT_LIST_CREATED_AT_TOOLTIP =
Expand Down
4 changes: 2 additions & 2 deletions src/app/frontend/events/eventcardlist.html
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@
</kd-resource-card-column>
<kd-resource-card-column>{{event.count}}</kd-resource-card-column>
<kd-resource-card-column>
{{event.firstSeen | date:'d/M/yy HH:mm':'UTC'}} UTC
{{event.firstSeen | date:'yyyy-MM-ddTHH:mm':'UTC'}} UTC
</kd-resource-card-column>
<kd-resource-card-column>
{{event.lastSeen | date:'d/M/yy HH:mm':'UTC'}} UTC
{{event.lastSeen | date:'yyyy-MM-ddTHH:mm':'UTC'}} UTC
</kd-resource-card-column>
</kd-resource-card-columns>
</kd-resource-card>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export default class HorizontalPodAutoscalerInfoController {
* @return {string} localized tooltip with the formatted creation date
*/
getLatScaledTooltip() {
let filter = this.interpolate_(`{{date | date:'short'}}`);
let filter = this.interpolate_(`{{date | date:'yyyy-MM-ddTHH:mm':'UTC'}}`);
/** @type {string} @desc Tooltip 'Last scaled at [some date]' showing the exact time of
* the last time the horizontal pod autoscaler was scaled.*/
let MSG_HORIZONTAL_POD_AUTOSCALER_DETAIL_LAST_SCALED_TOOLTIP = goog.getMsg(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export class HorizontalPodAutoscalerCardController {
* @return {string} localized tooltip with the formatted creation date
*/
getCreatedAtTooltip() {
let filter = this.interpolate_(`{{date | date:'short'}}`);
let filter = this.interpolate_(`{{date | date:'yyyy-MM-ddTHH:mm':'UTC'}}`);
/** @type {string} @desc Tooltip 'Created at [some date]' showing the exact creation time of
* the horizontal pod autoscaler.*/
let MSG_HORIZONTAL_POD_AUTOSCALER_LIST_CREATED_AT_TOOLTIP =
Expand Down
2 changes: 1 addition & 1 deletion src/app/frontend/ingresslist/card_component.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class IngressCardController {
* @return {string} localized tooltip with the formated start date
*/
getStartedAtTooltip(startDate) {
let filter = this.interpolate_(`{{date | date:'d/M/yy HH:mm':'UTC'}}`);
let filter = this.interpolate_(`{{date | date:'yyyy-MM-ddTHH:mm':'UTC'}}`);
/** @type {string} @desc Tooltip 'Started at [some date]' showing the exact start time of
* the ingress.*/
let MSG_INGRESS_LIST_STARTED_AT_TOOLTIP =
Expand Down
2 changes: 1 addition & 1 deletion src/app/frontend/joblist/jobcard.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
<kd-resource-card-column>
{{::$ctrl.job.objectMeta.creationTimestamp | relativeTime}}
<md-tooltip>
Created at {{::$ctrl.job.objectMeta.creationTimestamp | date:'short'}}
Created at {{::$ctrl.job.objectMeta.creationTimestamp | date:'yyyy-MM-ddTHH:mm':'UTC'}}
</md-tooltip>
</kd-resource-card-column>
<kd-resource-card-column>
Expand Down
2 changes: 1 addition & 1 deletion src/app/frontend/namespacelist/namespacecard_component.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export default class NamespaceCardController {
* @return {string} localized tooltip with the formated creation date
*/
getCreatedAtTooltip(creationDate) {
let filter = this.interpolate_(`{{date | date:'short'}}`);
let filter = this.interpolate_(`{{date | date:'yyyy-MM-ddTHH:mm':'UTC'}}`);
/** @type {string} @desc Tooltip 'Created at [some date]' showing the exact creation time of
* namespace. */
let MSG_NAMESPACE_LIST_CREATED_AT_TOOLTIP =
Expand Down
2 changes: 1 addition & 1 deletion src/app/frontend/nodelist/nodecard_component.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export default class NodeCardController {
* @return {string} localized tooltip with the formated creation date
*/
getCreatedAtTooltip(creationDate) {
let filter = this.interpolate_(`{{date | date:'short'}}`);
let filter = this.interpolate_(`{{date | date:'yyyy-MM-ddTHH:mm':'UTC'}}`);
/** @type {string} @desc Tooltip 'Created at [some date]' showing the exact creation time of
* node. */
let MSG_NODE_LIST_CREATED_AT_TOOLTIP =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export default class PersistentVolumeClaimCardController {
* @return {string} localized tooltip with the formatted creation date
*/
getCreatedAtTooltip(creationDate) {
let filter = this.interpolate_(`{{date | date:'short'}}`);
let filter = this.interpolate_(`{{date | date:'yyyy-MM-ddTHH:mm':'UTC'}}`);
/** @type {string} @desc Tooltip 'Created at [some date]' showing the exact creation time of
* persistent volume claim. */
let MSG_PERSISTENT_VOLUME_CLAIM_LIST_CREATED_AT_TOOLTIP =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export default class PersistentVolumeCardController {
* @return {string} localized tooltip with the formated creation date
*/
getCreatedAtTooltip(creationDate) {
let filter = this.interpolate_(`{{date | date:'short'}}`);
let filter = this.interpolate_(`{{date | date:'yyyy-MM-ddTHH:mm':'UTC'}}`);
/** @type {string} @desc Tooltip 'Created at [some date]' showing the exact creation time of
* persistent volume. */
let MSG_PERSISTENT_VOLUME_LIST_CREATED_AT_TOOLTIP =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export default class ReplicaSetCardController {
* @return {string} localized tooltip with the formated creation date
*/
getCreatedAtTooltip(creationDate) {
let filter = this.interpolate_(`{{date | date:'short'}}`);
let filter = this.interpolate_(`{{date | date:'yyyy-MM-ddTHH:mm':'UTC'}}`);
/** @type {string} @desc Tooltip 'Created at [some date]' showing the exact creation time of
* replica set. */
let MSG_REPLICA_SET_LIST_CREATED_AT_TOOLTIP =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export default class ReplicationControllerCardController {
* @return {string} localized tooltip with the formated creation date
*/
getCreatedAtTooltip(creationDate) {
let filter = this.interpolate_(`{{date | date:'short'}}`);
let filter = this.interpolate_(`{{date | date:'yyyy-MM-ddTHH:mm':'UTC'}}`);
/** @type {string} @desc Tooltip 'Created at [some date]' showing the exact creation time of
* replication controller. */
let MSG_RC_LIST_CREATED_AT_TOOLTIP =
Expand Down
2 changes: 1 addition & 1 deletion src/app/frontend/secretlist/card_component.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class SecretCardController {
* @return {string} localized tooltip with the formated start date
*/
getStartedAtTooltip(startDate) {
let filter = this.interpolate_(`{{date | date:'d/M/yy HH:mm':'UTC'}}`);
let filter = this.interpolate_(`{{date | date:'yyyy-MM-ddTHH:mm':'UTC'}}`);
/** @type {string} @desc Tooltip 'Started at [some date]' showing the exact start time of
* the secret.*/
let MSG_SECRET_LIST_STARTED_AT_TOOLTIP =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export default class StatefulSetCardController {
* @return {string} localized tooltip with the formated creation date
*/
getCreatedAtTooltip(creationDate) {
let filter = this.interpolate_(`{{date | date:'short'}}`);
let filter = this.interpolate_(`{{date | date:'yyyy-MM-ddTHH:mm':'UTC'}}`);
/** @type {string} @desc Tooltip 'Created at [some date]' showing the exact creation time of
* stateful set. */
let MSG_STATEFUL_SET_LIST_CREATED_AT_TOOLTIP =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ describe('Config Map card', () => {
});

it('should format the "created at" tooltip correctly', () => {
expect(ctrl.getCreatedAtTooltip('2016-06-06T09:13:12Z')).toMatch('Created at 6/6/16.*');
expect(ctrl.getCreatedAtTooltip('2016-06-06T09:13:12Z'))
.toMatch('Created at 2016-06-06T09:13.*');
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,6 @@ describe('Daemon Set card', () => {
},
};

expect(ctrl.getCreatedAtTooltip()).toMatch('Created at 6/[56]/16.*');
expect(ctrl.getCreatedAtTooltip()).toMatch('Created at 2016-06-06T09:13.*');
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ describe('Deployment card', () => {
});

it('should format the "created at" tooltip correctly', () => {
expect(ctrl.getCreatedAtTooltip('2016-06-06T09:13:12Z')).toMatch('Created at 6/[56]/16.*');
expect(ctrl.getCreatedAtTooltip('2016-06-06T09:13:12Z'))
.toMatch('Created at 2016-06-06T09:13.*');
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@ describe('Horizontal Pod Autoscaler card', () => {
});

it('should format the "created at" tooltip correctly', () => {
expect(ctrl.getCreatedAtTooltip()).toMatch('Created at 6/6/16.*');
expect(ctrl.getCreatedAtTooltip()).toMatch('Created at 2016-06-06T09:13.*');
});
});
3 changes: 2 additions & 1 deletion src/test/frontend/ingresslist/card_component_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ describe('Ingress card', () => {
});

it('should format the "ingress start date" tooltip correctly', () => {
expect(ctrl.getStartedAtTooltip('2016-06-06T09:13:12Z')).toBe('Created at 6/6/16 09:13 UTC');
expect(ctrl.getStartedAtTooltip('2016-06-06T09:13:12Z'))
.toBe('Created at 2016-06-06T09:13 UTC');
});

it('should return details href', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ describe('Namespace card', () => {
});

it('should format the "created at" tooltip correctly', () => {
expect(ctrl.getCreatedAtTooltip('2016-06-06T09:13:12Z')).toMatch('Created at 6/[56]/16.*');
expect(ctrl.getCreatedAtTooltip('2016-06-06T09:13:12Z'))
.toMatch('Created at 2016-06-06T09:13.*');
});
});
3 changes: 2 additions & 1 deletion src/test/frontend/nodelist/nodecard_component_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ describe('Node card', () => {
});

it('should format the "created at" tooltip correctly', () => {
expect(ctrl.getCreatedAtTooltip('2016-06-06T09:13:12Z')).toMatch('Created at 6/[56]/16.*');
expect(ctrl.getCreatedAtTooltip('2016-06-06T09:13:12Z'))
.toMatch('Created at 2016-06-06T09:13.*');
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ describe('Persistent Volume Claim card', () => {
});

it('should format the "created at" tooltip correctly', () => {
expect(ctrl.getCreatedAtTooltip('2016-06-06T09:13:12Z')).toMatch('Created at 6/6/16.*');
expect(ctrl.getCreatedAtTooltip('2016-06-06T09:13:12Z'))
.toMatch('Created at 2016-06-06T09:13.*');
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ describe('Persistent Volume card', () => {
});

it('should format the "created at" tooltip correctly', () => {
expect(ctrl.getCreatedAtTooltip('2016-06-06T09:13:12Z')).toMatch('Created at 6/6/16.*');
expect(ctrl.getCreatedAtTooltip('2016-06-06T09:13:12Z'))
.toMatch('Created at 2016-06-06T09:13.*');
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ describe('Replica Set card', () => {
});

it('should format the "created at" tooltip correctly', () => {
expect(ctrl.getCreatedAtTooltip('2016-06-06T09:13:12Z')).toMatch('Created at 6/[56]/16.*');
expect(ctrl.getCreatedAtTooltip('2016-06-06T09:13:12Z'))
.toMatch('Created at 2016-06-06T09:13.*');
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ describe('Replication controller card', () => {
});

it('should format the "created at" tooltip correctly', () => {
expect(ctrl.getCreatedAtTooltip('2016-06-06T09:13:12Z')).toMatch('Created at 6/[56]/16.*');
expect(ctrl.getCreatedAtTooltip('2016-06-06T09:13:12Z'))
.toMatch('Created at 2016-06-06T09:13.*');
});
});
3 changes: 2 additions & 1 deletion src/test/frontend/secretlist/card_component_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ describe('Secret card', () => {
});

it('should format the "secret start date" tooltip correctly', () => {
expect(ctrl.getStartedAtTooltip('2016-06-06T09:13:12Z')).toBe('Created at 6/6/16 09:13 UTC');
expect(ctrl.getStartedAtTooltip('2016-06-06T09:13:12Z'))
.toBe('Created at 2016-06-06T09:13 UTC');
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ describe('Stateful Set card', () => {
});

it('should format the "created at" tooltip correctly', () => {
expect(ctrl.getCreatedAtTooltip('2016-06-06T09:13:12Z')).toMatch('Created at 6/[56]/16.*');
expect(ctrl.getCreatedAtTooltip('2016-06-06T09:13:12Z'))
.toMatch('Created at 2016-06-06T09:13.*');
});
});

0 comments on commit f29313b

Please sign in to comment.