#

Liste der Tage in einem Monat, Tabelle mit 2 Spalten

 

 

Dieser Code in Javascript erzeugt eine Liste aller Tage im aktuellen Monat.

Dabei wird eine formatierte Liste mit 2 spalten erzeugt.

Erste Spalte: Tag in Iso-Format yyyy-MM-dd

Zweite Spalte: Tag formatiert in lokaler Tages-Anzeige WW dd MM yyyy mit Wochentag

//-< get: List Day of Month >-

var dtToday = new Date();

var dtMonth = dtToday.getMonth();

var date = new Date(dtToday.getFullYear(), dtMonth, 1);

var days = ["DayNr", "DayText"];

while (date.getMonth() === dtMonth) {

    var sDateIso = date.toISOString().split('T')[0];

    var sDateFormated = date.toLocaleString("de", { weekday: "short", day: "numeric", month: "short", year: "2-digit" });

    days.push({ "DayNr": sDateIso, "DayText": sDateFormated });

    date.setDate(date.getDate() + 1);

}

//-</ get: List Day of Month >-

 

 

Javascript Code: Füllen einer

 

 

 

 

 

Javascript Code : (devextreme load cell)

function onEditorPreparing(e) {

    //------< onEditorPreparing()  >--------

    //*event on edit, called for each cell

    //e=editorelement

    var dataField = e.dataField;

    if (dataField != null) {

        if (dataField.includes("col_")) {

//----< Setup Editor >----

//-< get: List Day of Month >-

var dtToday = new Date();

var dtMonth = dtToday.getMonth();

var date = new Date(dtToday.getFullYear(), dtMonth, 1);

var days = ["DayNr", "DayText"];

while (date.getMonth() === dtMonth) {

    var sDateIso = date.toISOString().split('T')[0];

    var sDateFormated = date.toLocaleString("de", { weekday: "short", day: "numeric", month: "short", year: "2-digit" });

    days.push({ "DayNr": sDateIso, "DayText": sDateFormated });

    date.setDate(date.getDate() + 1);

}

//-</ get: List Day of Month >-

 

//< set Control >

e.editorName = "dxSelectBox";

e.editorOptions.dropDownOptions = { height: 500, width:200 };

e.editorOptions.dataSource = days;

e.editorOptions.valueExpr = "DayNr";

e.editorOptions.displayExpr = "DayText";

//</ set Control >

//----</ Setup Editor >----

        }

    }

 

 

 

Mobile

.

0123movie.net