diff --git a/ui/app/clinical/common/controllers/visitController.js b/ui/app/clinical/common/controllers/visitController.js index 9982608c3a..d477e19634 100644 --- a/ui/app/clinical/common/controllers/visitController.js +++ b/ui/app/clinical/common/controllers/visitController.js @@ -63,7 +63,7 @@ angular.module('bahmni.clinical') }; $scope.displayDate = function (date) { - return moment(date).format("DD-MMM-YYYY"); + return moment(date).format("DD-MMM-YY"); }; $scope.$on("event:printVisitTab", function () { diff --git a/ui/app/clinical/consultation/views/bacteriology.html b/ui/app/clinical/consultation/views/bacteriology.html index 148f252e78..7c5c6a4b86 100644 --- a/ui/app/clinical/consultation/views/bacteriology.html +++ b/ui/app/clinical/consultation/views/bacteriology.html @@ -89,7 +89,7 @@

{{'BACTERIOLOGY_TAB_TITLE_KEY' | translate}}

{{getDisplayName(savedSpecimen)}} #{{savedSpecimen.identifier}} - {{ 'BACTERIOLOGY_ADDED_ON_KEY' | translate }} {{savedSpecimen.dateCollected | date: 'dd MMM yyyy'}} + {{ 'BACTERIOLOGY_ADDED_ON_KEY' | translate }} {{savedSpecimen.dateCollected | date: 'dd MMM yy'}}
diff --git a/ui/app/common/ui-helper/directives.js b/ui/app/common/ui-helper/directives.js index d09a002a53..1acb916d34 100644 --- a/ui/app/common/ui-helper/directives.js +++ b/ui/app/common/ui-helper/directives.js @@ -24,7 +24,7 @@ angular.module('bahmni.common.uiHelper') var link = function ($scope, element, attrs, ngModel) { var maxDate = attrs.maxDate; var minDate = attrs.minDate || "-120y"; - var format = attrs.dateFormat || 'dd-mm-yyyy'; + var format = attrs.dateFormat || 'dd-mm-yy'; element.datepicker({ changeYear: true, changeMonth: true, diff --git a/ui/app/common/util/dateUtil.js b/ui/app/common/util/dateUtil.js index 10f803ed4f..10b1a1ae50 100644 --- a/ui/app/common/util/dateUtil.js +++ b/ui/app/common/util/dateUtil.js @@ -83,7 +83,7 @@ Bahmni.Common.Util.DateUtil = { }, getDateInMonthsAndYears: function (date, format) { - var format = format || "MMM YYYY"; + var format = format || "MMM YY"; var dateRepresentation = isNaN(Number(date)) ? date : Number(date); if (!moment(dateRepresentation).isValid()) { return date; @@ -96,7 +96,7 @@ Bahmni.Common.Util.DateUtil = { if (!moment(dateRepresentation).isValid()) { return datetime; } - return dateRepresentation ? moment(dateRepresentation).format("DD MMM YYYY h:mm a") : null; + return dateRepresentation ? moment(dateRepresentation).format("DD MMM YY h:mm a") : null; }, formatDateWithoutTime: function (date) { @@ -104,16 +104,16 @@ Bahmni.Common.Util.DateUtil = { if (!moment(dateRepresentation).isValid()) { return date; } - return dateRepresentation ? moment(dateRepresentation).format("DD MMM YYYY") : null; + return dateRepresentation ? moment(dateRepresentation).format("DD MMM YY") : null; }, formatDateInStrictMode: function (date) { var dateRepresentation = isNaN(Number(date)) ? date : Number(date); if (moment(dateRepresentation, 'YYYY-MM-DD', true).isValid()) { - return moment(dateRepresentation).format("DD MMM YYYY"); + return moment(dateRepresentation).format("DD MMM YY"); } if (moment(dateRepresentation, 'YYYY-MM-DDTHH:mm:ss.SSSZZ', true).isValid()) { - return moment(dateRepresentation).format("DD MMM YYYY"); + return moment(dateRepresentation).format("DD MMM YY"); } return date; }, diff --git a/ui/app/reports/views/myReports.html b/ui/app/reports/views/myReports.html index 55ab730a2a..ad55400228 100644 --- a/ui/app/reports/views/myReports.html +++ b/ui/app/reports/views/myReports.html @@ -21,8 +21,8 @@

{{::'REPORTS_QUEUE' | translate}}

{{:: report.name }} {{ :: convertToDate(report.requestDatetime , 'hh:mm A')}} - {{ :: convertToDate(report.startDate , "DD MMM YYYY")}} - {{ :: convertToDate(report.endDate , "DD MMM YYYY")}} + {{ :: convertToDate(report.startDate , "DD MMM YY")}} + {{ :: convertToDate(report.endDate , "DD MMM YY")}} {{ :: getFormat(report.format) }} {{ report.status }} diff --git a/ui/test/unit/clinical/common/controllers/visitController.spec.js b/ui/test/unit/clinical/common/controllers/visitController.spec.js index fdfc6d64b7..9de6ed9cf3 100644 --- a/ui/test/unit/clinical/common/controllers/visitController.spec.js +++ b/ui/test/unit/clinical/common/controllers/visitController.spec.js @@ -125,7 +125,7 @@ describe('VisitController', function () { }); it('should check data format', function () { - expect(scope.displayDate(new Date('2014', '7', '15', '12'))).toBe('15-Aug-2014'); + expect(scope.displayDate(new Date('2014', '7', '15', '12'))).toBe('15-Aug-14'); }); it('should check test result class for expected style', function () { diff --git a/ui/test/unit/common/displaycontrols/obsVsObsFlowSheet/directives/obsToObsFlowSheet.spec.js b/ui/test/unit/common/displaycontrols/obsVsObsFlowSheet/directives/obsToObsFlowSheet.spec.js index c70bff7a14..613400beba 100644 --- a/ui/test/unit/common/displaycontrols/obsVsObsFlowSheet/directives/obsToObsFlowSheet.spec.js +++ b/ui/test/unit/common/displaycontrols/obsVsObsFlowSheet/directives/obsToObsFlowSheet.spec.js @@ -611,7 +611,7 @@ describe('obsToObsFlowSheet DisplayControl', function () { } ]; - expect(compiledElementScope.commafy(observations)).toEqual("10 Oct 2015"); + expect(compiledElementScope.commafy(observations)).toEqual("10 Oct 15"); }); it('should return just month and year if the concept datatype is date and configured to show month and year', function () { @@ -662,7 +662,7 @@ describe('obsToObsFlowSheet DisplayControl', function () { } ]; - expect(compiledElementScope.commafy(observations)).toEqual("Oct 2015"); + expect(compiledElementScope.commafy(observations)).toEqual("Oct 15"); }); it('should return abbreviation of the coded answer if the concept is coded and configured to show abbreviation', function () { diff --git a/ui/test/unit/common/displaycontrols/orders/directives/ordersControl.spec.js b/ui/test/unit/common/displaycontrols/orders/directives/ordersControl.spec.js index 8827878118..75ef126428 100644 --- a/ui/test/unit/common/displaycontrols/orders/directives/ordersControl.spec.js +++ b/ui/test/unit/common/displaycontrols/orders/directives/ordersControl.spec.js @@ -90,7 +90,7 @@ describe("OrdersDisplayControl", function () { var compiledElementScope = element.isolateScope(); scope.$digest(); - var expectedDate = moment(orders[0].orderDate).format("DD MMM YYYY h:mm a"); + var expectedDate = moment(orders[0].orderDate).format("DD MMM YY h:mm a"); expect(compiledElementScope.getTitle(orders[0])).toBe("Absconding on " + expectedDate + " by Surajkumar Surajkumar Surajkumar") }); diff --git a/ui/test/unit/common/domain/mappers/observationValueMapper.spec.js b/ui/test/unit/common/domain/mappers/observationValueMapper.spec.js index 263285af78..6ca9011f1f 100644 --- a/ui/test/unit/common/domain/mappers/observationValueMapper.spec.js +++ b/ui/test/unit/common/domain/mappers/observationValueMapper.spec.js @@ -7,7 +7,7 @@ describe("Observation Value Mapper", function () { it("should return datetime value", function() { var obs = {type: "Datetime", value: "2015-12-05 16:02:00", concept: {}}; - expect(mapper.map(obs)).toBe("05 Dec 2015 4:02 pm"); + expect(mapper.map(obs)).toBe("05 Dec 15 4:02 pm"); }); it("should return multiselect values", function() { diff --git a/ui/test/unit/common/models/age.spec.js b/ui/test/unit/common/models/age.spec.js index 5a0cefd50a..5871a2b3b3 100644 --- a/ui/test/unit/common/models/age.spec.js +++ b/ui/test/unit/common/models/age.spec.js @@ -31,7 +31,7 @@ describe("Age", function(){ var age = ageFactory.create(0, 0, 0); var birthDate = dateUtil.now(); - expect(moment(ageFactory.calculateBirthDate(age)).format("DD MMM YYYY").toString()).toEqual(moment(birthDate).format("DD MMM YYYY").toString()); + expect(moment(ageFactory.calculateBirthDate(age)).format("DD MMM YY").toString()).toEqual(moment(birthDate).format("DD MMM YY").toString()); }); it("should return date of birth", function(){ diff --git a/ui/test/unit/common/obs/directives/showObservation.spec.js b/ui/test/unit/common/obs/directives/showObservation.spec.js index 48aff66696..49b6ca6575 100644 --- a/ui/test/unit/common/obs/directives/showObservation.spec.js +++ b/ui/test/unit/common/obs/directives/showObservation.spec.js @@ -103,7 +103,7 @@ describe("ensure that the directive show-observation works properly", function ( scope.$digest(); expect(compiledScope).not.toBeUndefined(); - expect(compiledScope.dateString(observation)).toBe(moment(obsDate).format("DD MMM YYYY h:mm a")); + expect(compiledScope.dateString(observation)).toBe(moment(obsDate).format("DD MMM YY h:mm a")); }); it("should open video in a new dialog", function () { diff --git a/ui/test/unit/common/obs/observation.spec.js b/ui/test/unit/common/obs/observation.spec.js index 58497f5428..881c9b7f61 100644 --- a/ui/test/unit/common/obs/observation.spec.js +++ b/ui/test/unit/common/obs/observation.spec.js @@ -59,7 +59,7 @@ describe("Observation", function () { it("should return datetime in specific format", function () { var observation = new Observation({"type": "Datetime", "value": "2014-12-05 17:00:00"}); - expect(observation.getDisplayValue()).toBe("05 Dec 2014 5:00 pm"); + expect(observation.getDisplayValue()).toBe("05 Dec 14 5:00 pm"); }); it("should return empty if value is null", function () { @@ -71,15 +71,15 @@ describe("Observation", function () { it("should format date to bahmniDate if value is of type date", function () { var observation = new Observation({"type": "Date", "value": "2012-12-10"}); - expect(observation.getDisplayValue()).toBe("10 Dec 2012"); + expect(observation.getDisplayValue()).toBe("10 Dec 12"); }); it("should format date in months and years if config is set to display in months and years", function(){ var observation = new Observation({"type": "Date", "value": "2012-12-10"},{"displayMonthAndYear": true}); - expect((observation.getDisplayValue())).toBe("Dec 2012"); + expect((observation.getDisplayValue())).toBe("Dec 12"); }); it("should format date in text to months and years if config is set to display in months and years", function(){ var observation = new Observation({"type": "text", "value": "2012-12-10"},{"displayMonthAndYear": true}); - expect((observation.getDisplayValue())).toBe("Dec 2012"); + expect((observation.getDisplayValue())).toBe("Dec 12"); }); }); diff --git a/ui/test/unit/common/uicontrols/programmanagement/controllers/manageProgramController.spec.js b/ui/test/unit/common/uicontrols/programmanagement/controllers/manageProgramController.spec.js index eadf52a507..e8bbcf93a4 100644 --- a/ui/test/unit/common/uicontrols/programmanagement/controllers/manageProgramController.spec.js +++ b/ui/test/unit/common/uicontrols/programmanagement/controllers/manageProgramController.spec.js @@ -390,7 +390,7 @@ describe("ManageProgramController", function () { scope.updatePatientProgram(patientProgramToBeUpdated); expect(messageService.showMessage) - .toHaveBeenCalledWith("error", "PROGRAM_MANAGEMENT_STATE_CANT_START_BEFORE_KEY (15 Jul 2015)"); + .toHaveBeenCalledWith("error", "PROGRAM_MANAGEMENT_STATE_CANT_START_BEFORE_KEY (15 Jul 15)"); }); it("should transit from one state to another successfully only if different state is selected", function () { @@ -473,7 +473,7 @@ describe("ManageProgramController", function () { scope.updatePatientProgram(programToBeUpdated); - expect(messageService.showMessage).toHaveBeenCalledWith("error", "PROGRAM_MANAGEMENT_PROGRAM_CANT_END_BEFORE_KEY (15 Jul 2015)"); + expect(messageService.showMessage).toHaveBeenCalledWith("error", "PROGRAM_MANAGEMENT_PROGRAM_CANT_END_BEFORE_KEY (15 Jul 15)"); }); it('should end a program successfully', function () { diff --git a/ui/test/unit/common/util/dateUtil.spec.js b/ui/test/unit/common/util/dateUtil.spec.js index c50032c4bc..55338f600c 100644 --- a/ui/test/unit/common/util/dateUtil.spec.js +++ b/ui/test/unit/common/util/dateUtil.spec.js @@ -258,12 +258,12 @@ describe('DateUtil', function () { describe("formatDateWithTime", function () { it("should take a long representation of date and format", function () { var date = new Date(1427803080000); - expect(dateUtil.formatDateWithTime("1427803080000")).toEqual(moment(date).format("DD MMM YYYY h:mm a")); + expect(dateUtil.formatDateWithTime("1427803080000")).toEqual(moment(date).format("DD MMM YY h:mm a")); }); it("should take a string representation of date and format", function () { var date = new Date(); - expect(dateUtil.formatDateWithTime(moment(date).format(dateFormat))).toEqual(moment(date).format("DD MMM YYYY h:mm a")); + expect(dateUtil.formatDateWithTime(moment(date).format(dateFormat))).toEqual(moment(date).format("DD MMM YY h:mm a")); }); it("should not break for undefined and return null", function () { @@ -278,12 +278,12 @@ describe('DateUtil', function () { describe("formatDateWithoutTime", function () { it("should take a long representation of date and format", function () { var date = new Date(1427803080000); - expect(dateUtil.formatDateWithoutTime("1427803080000")).toEqual(moment(date).format("DD MMM YYYY")); + expect(dateUtil.formatDateWithoutTime("1427803080000")).toEqual(moment(date).format("DD MMM YY")); }); it("should take a string representation of date and format", function () { var date = new Date(); - expect(dateUtil.formatDateWithoutTime(moment(date).format(dateFormat))).toEqual(moment(date).format("DD MMM YYYY")); + expect(dateUtil.formatDateWithoutTime(moment(date).format(dateFormat))).toEqual(moment(date).format("DD MMM YY")); }); it("should not break for undefined and return null", function () { @@ -345,17 +345,17 @@ describe('DateUtil', function () { describe("getDateWithMonthsAndYears", function(){ it("should return date with months and years", function(){ - expect(dateUtil.getDateInMonthsAndYears(new Date('2014', '7', '15', '12','30','25'))).toBe('Aug 2014'); + expect(dateUtil.getDateInMonthsAndYears(new Date('2014', '7', '15', '12','30','25'))).toBe('Aug 14'); }); }); describe("formatDateInStrictMode", function(){ - it("should return date in dd MMM YYYY format when date with yyyy-MM-dd format is passed", function(){ - expect(dateUtil.formatDateInStrictMode('2016-02-10')).toBe('10 Feb 2016'); + it("should return date in dd MMM yy format when date with yyyy-MM-dd format is passed", function(){ + expect(dateUtil.formatDateInStrictMode('2016-02-10')).toBe('10 Feb 16'); }); - it("should return date in dd MMM YYYY format when date with yyyy-MM-ddTHH:mm:ss.SSSZ is passed", function(){ - expect(dateUtil.formatDateInStrictMode('2016-03-01T10:30:00.000+0530')).toBe(moment('2016-03-01T10:30:00.000+0530').format('DD MMM YYYY')); + it("should return date in dd MMM yy format when date with yyyy-MM-ddTHH:mm:ss.SSSZ is passed", function(){ + expect(dateUtil.formatDateInStrictMode('2016-03-01T10:30:00.000+0530')).toBe(moment('2016-03-01T10:30:00.000+0530').format('DD MMM YY')); }); it("should return the string if the format does not match yyyy-MM-dd or yyyy-MM-ddTHH:mm:ss.SSSZ", function(){ diff --git a/ui/test/unit/reports/controllers/myReportsController.spec.js b/ui/test/unit/reports/controllers/myReportsController.spec.js index eb69f39369..1a558ab3bb 100644 --- a/ui/test/unit/reports/controllers/myReportsController.spec.js +++ b/ui/test/unit/reports/controllers/myReportsController.spec.js @@ -201,7 +201,7 @@ describe("MyReportsController", function () { it("should convert unixTimeStamps to given format", function () { expect(scope.convertToDate(1474529795000, 'hh:mm A')).toEqual(moment(1474529795000).format('hh:mm A')); - expect(scope.convertToDate(1474529795000, "DD MMM YYYY")).toEqual(moment(1474529795000).format('DD MMM YYYY')); + expect(scope.convertToDate(1474529795000, "DD MMM YY")).toEqual(moment(1474529795000).format('DD MMM YY')); expect(scope.convertToDate(1474529795000, "MMMM Do YYYY, dddd")).toEqual(moment(1474529795000).format('MMMM Do YYYY, dddd')); });