Skip to content

Instantly share code, notes, and snippets.

@genuinefafa
Last active June 27, 2017 17:03
Show Gist options
  • Save genuinefafa/b04d114ebb83158a228f2bd027a9c891 to your computer and use it in GitHub Desktop.
Save genuinefafa/b04d114ebb83158a228f2bd027a9c891 to your computer and use it in GitHub Desktop.
import { Component, AfterViewInit, ViewChild, TemplateRef } from "@angular/core";
import { SuiLocalizationService } from "../../../../../src/util/services/localization.service";
@Component({
selector: "demo-page-test",
templateUrl: "./test.page.html"
})
export class TestPage {
public date:Date = new Date();
public minDate:Date;
public maxDate:Date;
constructor(private _localizationService:SuiLocalizationService) {
this.localizateMe();
const today = new Date();
console.log(`start component value new Date() = ${today} `);
this.minDate = new Date(today.getFullYear(), today.getMonth() - 2);
this.maxDate = new Date(today.getFullYear(), today.getMonth() + 10);
console.log(`new Date(today.getFullYear(), today.getMonth() - 2) = ${this.minDate}`);
console.log(`new Date(today.getFullYear(), today.getMonth() + 10) = ${this.maxDate}`);
}
public pickerSelectedDateChange(event:any):void {
console.log(`pickerSelectedDateChange value ${event}`);
console.log(`pickerSelectedDateChange current component value ${this.date}`);
}
public log(item:any):void {
console.log(item);
}
public test():void {
console.log(`btn current component value ${this.date}`);
}
public localizateMe():void {
this._localizationService.setValues("ar", {
datepicker: {
months: [
"Enero", "Febrero", "Marzo", "Abril",
"Mayo", "Junio", "Julio", "Agosto",
"Septiembre", "Octubre", "Noviembre", "Diciembre"
],
monthsShort: [
"Ene", "Feb", "Mar", "Abr",
"May", "Jun", "Jul", "Ago",
"Sep", "Oct", "Nov", "Dic"
],
weekdays: [
"Domingo", "Lunes", "Martes", "Miércoles",
"Jueves", "Viernes", "Sábado"
],
weekdaysShort: [
"D", "L", "M", "M",
"J", "V", "S"
],
firstDayOfWeek: 0,
formats: {
time: "HH:mm",
datetime: "DD-MMM-YYYY HH:mm",
date: "DD-MMM-YYYY",
month: "MMMM YYYY",
year: "YYYY"
}
}
});
this._localizationService.setLanguage("ar");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment