Как изменить формат даты в jhipster?

213
19 сентября 2017, 06:30

Дата в моем проекте

<form name="editForm" role="form" novalidate (ngSubmit)="save()" #editForm="ngForm">
<h4 class="modal-title" id="myContractLabel">
    <span jhiTranslate="portfelApp.contract.home.createOrEditLabel"></span>
    <span>ID : {{ contract.id }}</span>
</h4>
<jhi-alert-error></jhi-alert-error>
<jhi-alert></jhi-alert>
<fieldset [disabled]="contract.id">
<div class="row">
    <div class="form-group col-lg-4">
        <label class="form-control-label" jhiTranslate="portfelApp.contract.fullNumber" for="field_fullNumber">Full Number</label>
        <input type="text" class="form-control" name="fullNumber" id="field_fullNumber"
               [(ngModel)]="contract.fullNumber" required />
        <div [hidden]="!(editForm.controls.fullNumber?.dirty && editForm.controls.fullNumber?.invalid)">
            <small class="form-text text-danger"
                   [hidden]="!editForm.controls.fullNumber?.errors?.required" jhiTranslate="entity.validation.required">
                This field is required.
            </small>
        </div>
    </div>
    <div class="form-group col-lg-4">
        <label class="form-control-label" jhiTranslate="portfelApp.contract.clientName" for="field_clientName">Client Name</label>
        <input type="text" class="form-control" name="clientName" id="field_clientName"
               [(ngModel)]="contract.clientName" required />
        <div [hidden]="!(editForm.controls.clientName?.dirty && editForm.controls.clientName?.invalid)">
            <small class="form-text text-danger"
                   [hidden]="!editForm.controls.clientName?.errors?.required" jhiTranslate="entity.validation.required">
                This field is required.
            </small>
        </div>
    </div>
    <div class="form-group col-lg-4">
        <label jhiTranslate="portfelApp.contract.insType" for="field_insType">Ins Type</label>
        <select class="form-control" id="field_insType" name="insType" [(ngModel)]="contract.insTypeId" required>
            <option [ngValue]="null"></option>
            <option [ngValue]="insTypeOption.id" *ngFor="let insTypeOption of instypes; trackBy: trackInsTypeById">{{insTypeOption.code + ' - ' + insTypeOption.nameRu}}</option>
        </select>
        <div [hidden]="!(editForm.controls.insType?.dirty && editForm.controls.insType?.invalid)">
            <small class="form-text text-danger"
                   [hidden]="!editForm.controls.insType?.errors?.required" jhiTranslate="entity.validation.required">
            </small>
        </div>
    </div>
    <div class="form-group col-lg-4">
        <label class="form-control-label" jhiTranslate="portfelApp.contract.insSum" for="field_insSum">Ins Sum</label>
        <input type="number" class="form-control" name="insSum" id="field_insSum"
            [(ngModel)]="contract.insSum" required />
        <div [hidden]="!(editForm.controls.insSum?.dirty && editForm.controls.insSum?.invalid)">
            <small class="form-text text-danger"
               [hidden]="!editForm.controls.insSum?.errors?.required" jhiTranslate="entity.validation.required">
               This field is required.
            </small>
            <small class="form-text text-danger"
                [hidden]="!editForm.controls.insSum?.errors?.number" jhiTranslate="entity.validation.number">
                This field should be a number.
            </small>
        </div>
    </div>
    <div class="form-group col-lg-2">
        <label jhiTranslate="portfelApp.contract.insSumCurrency" for="field_insSumCurrency">Ins Sum Currency</label>
        <select class="form-control" id="field_insSumCurrency" name="insSumCurrency" [(ngModel)]="contract.insSumCurrencyId" required>
            <option [ngValue]="null"></option>
            <option [ngValue]="currencyOption.id" *ngFor="let currencyOption of currencies; trackBy: trackCurrencyById">{{currencyOption.code}}</option>
        </select>
        <div [hidden]="!(editForm.controls.insSumCurrency?.dirty && editForm.controls.insSumCurrency?.invalid)">
            <small class="form-text text-danger"
                   [hidden]="!editForm.controls.insSumCurrency?.errors?.required" jhiTranslate="entity.validation.required">
            </small>
        </div>
    </div>
    <div class="form-group col-lg-3">
        <label class="form-control-label" jhiTranslate="portfelApp.contract.startDate" for="field_startDate">Start Date</label>
        <div class="input-group">
  input id="field_startDate" type="text" class="form-control" name="startDate" ngbDatepicker  #startDateDp="ngbDatepicker" [(ngModel)]="contract.startDate"
                   required [maxDate]="contract.endDate"/>
            <span class="input-group-btn">
                <button type="button" class="btn btn-default" (click)="startDateDp.toggle()"><i class="fa fa-calendar"></i></button>
            </span>
        </div>
        <div [hidden]="!(editForm.controls.startDate?.dirty && editForm.controls.startDate?.invalid)">
            <small class="form-text text-danger"
                   [hidden]="!editForm.controls.startDate?.errors?.required" jhiTranslate="entity.validation.required">
                This field is required.
            </small>
        </div>
    </div>
    <div class="form-group col-lg-3">
        <label class="form-control-label" jhiTranslate="portfelApp.contract.endDate" for="field_endDate">End Date</label>
        <div class="input-group">
            <input id="field_endDate" type="text" class="form-control" name="endDate" ngbDatepicker  #endDateDp="ngbDatepicker" [(ngModel)]="contract.endDate"
                   required [minDate]="contract.startDate"/>
            <span class="input-group-btn">
                <button type="button" class="btn btn-default" (click)="endDateDp.toggle()"><i class="fa fa-calendar"></i></button>
            </span>
        </div>
        <div [hidden]="!(editForm.controls.endDate?.dirty && editForm.controls.endDate?.invalid)">
            <small class="form-text text-danger"
                   [hidden]="!editForm.controls.endDate?.errors?.required" jhiTranslate="entity.validation.required">
                This field is required.
            </small>
        </div>
    </div>
    <div class="form-group col-lg-4">
        <label class="form-control-label" jhiTranslate="portfelApp.contract.insPremia" for="field_insPremia">Ins Premia</label>
        <input type="number" class="form-control" name="insPremia" id="field_insPremia"
            [(ngModel)]="contract.insPremia" required />
        <div [hidden]="!(editForm.controls.insPremia?.dirty && editForm.controls.insPremia?.invalid)">
            <small class="form-text text-danger"
               [hidden]="!editForm.controls.insPremia?.errors?.required" jhiTranslate="entity.validation.required">
               This field is required.
            </small>
            <small class="form-text text-danger"
                [hidden]="!editForm.controls.insPremia?.errors?.number" jhiTranslate="entity.validation.number">
                This field should be a number.
            </small>
        </div>
    </div>
    <div class="form-group col-lg-2">
        <label jhiTranslate="portfelApp.contract.insPremiaCurrency" for="field_insPremiaCurrency">Ins Premia Currency</label>
        <select class="form-control" id="field_insPremiaCurrency" name="insPremiaCurrency" [(ngModel)]="contract.insPremiaCurrencyId" required>
            <option [ngValue]="null"></option>
            <option [ngValue]="currencyOption.id" *ngFor="let currencyOption of currencies; trackBy: trackCurrencyById">{{currencyOption.code}}</option>
        </select>
        <div [hidden]="!(editForm.controls.insPremiaCurrency?.dirty && editForm.controls.insPremiaCurrency?.invalid)">
            <small class="form-text text-danger"
                   [hidden]="!editForm.controls.insPremiaCurrency?.errors?.required" jhiTranslate="entity.validation.required">
            </small>
        </div>
    </div>
    <div class="form-group col-lg-3">
        <label class="form-control-label" jhiTranslate="portfelApp.contract.franchise" for="field_franchise">Franchise</label>
        <input type="number" class="form-control" name="franchise" id="field_franchise"
               [(ngModel)]="contract.franchise" min="0" max="100" />
        <div [hidden]="!(editForm.controls.franchise?.dirty && editForm.controls.franchise?.invalid)">
            <small class="form-text text-danger"
                   [hidden]="!editForm.controls.franchise?.errors?.min" jhiTranslate="entity.validation.min" translateValues="{ min: 0 }">
                This field should be at least 0.
            </small>
            <small class="form-text text-danger"
                   [hidden]="!editForm.controls.franchise?.errors?.max" jhiTranslate="entity.validation.max" translateValues="{ max: 100 }">
                This field cannot be more than 100.
            </small>
            <small class="form-text text-danger"
                   [hidden]="!editForm.controls.franchise?.errors?.number" jhiTranslate="entity.validation.number">
                This field should be a number.
            </small>
        </div>
    </div>
    <div class="form-group col-lg-3">
        <label jhiTranslate="portfelApp.contract.department" for="field_department">Department</label>
        <select class="form-control" id="field_department" name="department" [(ngModel)]="contract.departmentId" >
            <option [ngValue]="null"></option>
            <option [ngValue]="departmentOption.id" *ngFor="let departmentOption of departments; trackBy: trackDepartmentById">{{departmentOption.nameRu}}</option>
        </select>
    </div>
    <!--<div class="form-group">-->
        <!--<label jhiTranslate="portfelApp.contract.client" for="field_client">Client</label>-->
        <!--<select class="form-control" id="field_client" name="client" [(ngModel)]="contract.clientId" >-->
            <!--<option [ngValue]="null"></option>-->
            <!--<option [ngValue]="clientOption.id" *ngFor="let clientOption of clients; trackBy: trackClientById">{{clientOption.id}}</option>-->
        <!--</select>-->
    <!--</div>-->
</div>
</fieldset>
<jhi-reins-child *ngFor="let reins of reinses"
            [reins]="reins"
            [contractId]="contract.id">
</jhi-reins-child>
<div class="modal-footer">
    <button type="button" class="btn btn-default" data-dismiss="modal" (click)="clear()">
        <span class="fa fa-ban"></span>&nbsp;<span jhiTranslate="entity.action.cancel">Cancel</span>
    </button>
    <button [disabled]="!contract.id" class="btn btn-primary float-right jh-create-entity create-reins" [routerLink]="['/', { outlets: { popup: 'reins-new2/' + contract.id } }]"">
        <span class="fa fa-plus"></span>
        <span  jhiTranslate="portfelApp.reins.home.createLabel">
        </span>
    </button>
    <button type="submit" [disabled]="editForm.form.invalid || isSaving" class="btn btn-primary">
        <span class="fa fa-save"></span>&nbsp;<span jhiTranslate="entity.action.save">Save</span>
    </button>
</div>
</form>

Но мне нужно 07.09.2017

READ ALSO
Вопрос по методу DateTimeFormatter.ofPattern?

Вопрос по методу DateTimeFormatter.ofPattern?

Мне необходимо преобразовать строку с датой в объект LoacalDate чтобы с ним дальше работатьПостоянно появляется сообщение: Exception in thread "main" java

176
При попытке изменить цвет одного Shape&#39;а из класса, меняются цвета всех фигур в разметке

При попытке изменить цвет одного Shape'а из класса, меняются цвета всех фигур в разметке

У меня есть десять кнопок при нажатии которых происходит сохранение значения кнопки, далее при повторном открытии активности рядом должен...

232
Всплывающие блоки по клику через js

Всплывающие блоки по клику через js

Добрый вечер, коллеги! Прошу помочь человеку, недавно начавшему изучать jsЕсть задача - некая боковая навигация, состоящая из списка со ссылками,...

174
Использование связей Active Record в Ruby on Rails

Использование связей Active Record в Ruby on Rails

Имеются два класса: Article (has_many comments) и Comment(belongs_to article)

184