Skip to content

Commit

Permalink
datetime: updated with 2 digit month n date value
Browse files Browse the repository at this point in the history
  • Loading branch information
rashmithakkar committed Apr 22, 2020
1 parent 9b921da commit d0ce456
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions src/module/forms/datetimepicker/datetimepicker.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,8 @@ export class AmexioDateTimePickerComponent extends ListBaseDatepickerComponent<s
if (!this.timestamp) {

this.dateModel = this.selectedDate.getFullYear() + '-' +
(this.selectedDate.getMonth() + 1) + '-' + this.selectedDate.getDate();
("0" + (this.selectedDate.getMonth() + 1)).slice(-2)
+ '-' + ("0" + this.selectedDate.getDate()).slice(-2);

this.setDateModel();
this.onChangeCallback(this.dateModel);
Expand Down Expand Up @@ -507,7 +508,8 @@ export class AmexioDateTimePickerComponent extends ListBaseDatepickerComponent<s
if (!this.timestamp) {
this.dateModel = new Date(this.dateModel);
this.dateModel = this.dateModel.getFullYear() + '-'
+ (this.dateModel.getMonth() + 1) + '-' + this.dateModel.getDate();
+ (("0" + (this.dateModel.getMonth() + 1)).slice(-2)) + '-'
+ ("0" + this.dateModel.getDate()).slice(-2);

}
}
Expand Down Expand Up @@ -702,7 +704,9 @@ export class AmexioDateTimePickerComponent extends ListBaseDatepickerComponent<s
if (!this.timestamp) {
this.dateModel = new Date(this.dateModel);
this.dateModel = this.dateModel.getFullYear() + '-' +
(this.dateModel.getMonth() + 1) + '-' + this.dateModel.getDate();
("0" + (this.dateModel.getMonth() + 1)).slice(-2)
+ '-' + ("0" + this.dateModel.getDate()).slice(-2)
;
this.setDateModel();
this.onChangeCallback(this.dateModel);
}
Expand All @@ -725,7 +729,9 @@ export class AmexioDateTimePickerComponent extends ListBaseDatepickerComponent<s
this.dateModel = this.innerValue;
if (!this.timestamp) {
this.dateModel = this.dateModel.getFullYear() + '-'
+ this.dateModel.getMonth() + '-' + this.dateModel.getDate();
+ ("0" + (this.dateModel.getMonth() + 1)).slice(-2)
+ '-' + ("0" + this.dateModel.getDate()).slice(-2)
;

this.setDateModel();
this.onChangeCallback(this.dateModel);
Expand Down Expand Up @@ -775,7 +781,9 @@ export class AmexioDateTimePickerComponent extends ListBaseDatepickerComponent<s
if (!this.timestamp) {
this.dateModel = new Date(this.dateModel);
this.dateModel = this.dateModel.getFullYear() + '-' +
(this.dateModel.getMonth() + 1) + '-' + this.dateModel.getDate();
("0" + (this.dateModel.getMonth() + 1)).slice(-2)
+ '-' + ("0" + this.dateModel.getDate()).slice(-2)
;

this.setDateModel();
this.onChangeCallback(this.dateModel);
Expand All @@ -786,7 +794,9 @@ export class AmexioDateTimePickerComponent extends ListBaseDatepickerComponent<s
if (!this.timestamp) {
this.dateModel = new Date(this.dateModel);
this.dateModel = this.dateModel.getFullYear() + '-' +
(this.dateModel.getMonth() + 1) + '-' + this.dateModel.getDate();
("0" + (this.dateModel.getMonth() + 1)).slice(-2)
+ '-' + ("0" + this.dateModel.getDate()).slice(-2)
;
this.setDateModel();
this.onChangeCallback(this.dateModel);

Expand Down

0 comments on commit d0ce456

Please sign in to comment.