I need to know how to export and import a Javascript class in C #, I tried to do it but it does not work out. This is my code to import, here in this code I get the vales of the current date and time, and the values obtained use it in other Javascript
$(document).ready(function () {
var FechaActual = $('input:text[id=COMD_FECHA_ATENCION]').val();
var HoraActual = $('input:text[id=COMD_FECHA]').val();
class Fecha{
constructor(fecha, hora) {
this.fecha = FechaActual;
this.hora = HoraActual;
}
}
var fech = new Fecha();
module.exports = Fecha;
console.log(fech.fecha);
console.log(fech.hora);
})
<div class="col-md-2">
<div class="form-group">
<label>Fecha de Atención</label>
<input type="text" class="form-control" id="COMD_FECHA_ATENCION" name="COMD_FECHA_ATENCION" value="@Model.COMD_FECHA_ATENCION.ToString("dd/MM/yyyy")" />
</div>
</div>
<div class="col-md-2">
<div class="form-group">
<label for="COMD_FECHA">Hora de Atención</label>
<input type="hidden" id="txtHoraEAtencion" value="@Model.COMD_FECHA.ToString("HH:mm")">
<input type="text" class="form-control" id="COMD_FECHA" name="COMD_FECHA" value="@Model.COMD_FECHA" />
</div>
</div>
Here's my code where I'm trying to import that Date Class
const{Fecha}=require('.../Views/Consulta/RegistrarFecha.cshtml');