SaturnTeam / saturn-datepicker

Angular Material Datepicker with range selection
MIT License
278 stars 110 forks source link

language translation issue in sat-Datepicker #140

Open sureshkuma opened 4 years ago

sureshkuma commented 4 years ago

the issue while translating from english language to german language the value inside the input field is not translating into german language.am using sat-datepicker.we are using the angular 7 version.Any help Files>>>>>>>>>>>> component.html>>>

{{ 'REPORTSINFO.DEVICENAME' | translate }} {{ device.device_model_and_name }} {{'REPORTSINFO.DATERANGE' | translate }}

component.ts >>>>>

import { Component, Input, Output, EventEmitter, OnChanges, SimpleChanges, OnInit } from '@angular/core'; import { Device } from 'src/app/dashboard/models'; import { DateRange } from 'src/app/home/select-duration/models'; import { IDeviceRange } from './device-range';

@Component({ selector: 'app-device-range', templateUrl: './device-range.component.html', styleUrls: ['./device-range.component.scss'] }) export class DeviceRangeComponent implements OnChanges, OnInit {

@Input() devices: Device[] = []; @Input() selectedDevice: string; @Input() setDateSelectorResponsiveView: boolean; @Input() dateRange: DateRange = { startDate: new Date(), endDate: new Date(), };

@Output() deviceInfo = new EventEmitter(); rangeValue = { begin: new Date(), end: new Date(), }; minDate: Date; maxDate: Date; device: Device;

constructor() { }

ngOnChanges(changes: SimpleChanges) { if (changes) { if (changes.dateRange) { this.rangeValue = { begin: changes.dateRange.currentValue.startDate, end: changes.dateRange.currentValue.endDate }; } } }

ngOnInit() { this.initializeMinMaxDate(); }

initializeMinMaxDate() { const previousDate = new Date(); const currentDate = new Date(); // End date is included in the count hence subtracting 30 only previousDate.setDate(previousDate.getDate() - 30); this.minDate = new Date(previousDate.getFullYear(), previousDate.getMonth(), previousDate.getDate()); this.maxDate = new Date(currentDate.getFullYear(), currentDate.getMonth(), currentDate.getDate()); }

dateRangeChange(event) { this.dateRange = { startDate: event.value.begin, endDate: event.value.end, }; this.onDeviceChange(); }