Skip to content

Commit

Permalink
Merge pull request #15 from hargata/Hargata/ghcr.auto
Browse files Browse the repository at this point in the history
fixed short date pattern for datetimepicker.
  • Loading branch information
hargata authored Jan 7, 2024
2 parents b972d5b + e64d4f7 commit 42f7bd2
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 8 deletions.
15 changes: 15 additions & 0 deletions Views/Shared/_Layout.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,16 @@
@{
var useDarkMode = bool.Parse(Configuration["UseDarkMode"]);
var enableCsvImports = bool.Parse(Configuration["EnableCsvImports"]);
var shortDatePattern = System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.ShortDatePattern;
shortDatePattern = shortDatePattern.ToLower();
if (!shortDatePattern.Contains("dd"))
{
shortDatePattern = shortDatePattern.Replace("d", "dd");
}
if (!shortDatePattern.Contains("mm"))
{
shortDatePattern = shortDatePattern.Replace("m", "mm");
}
}
<html lang="en" data-bs-theme="@(useDarkMode ? "dark" : "light")">
<head>
Expand All @@ -28,6 +38,11 @@
enableCsvImport : "@enableCsvImports" == "True"
}
}
function getShortDatePattern() {
return {
pattern: "@shortDatePattern"
}
}
</script>
@await RenderSectionAsync("Scripts", required: false)
</head>
Expand Down
6 changes: 4 additions & 2 deletions wwwroot/js/collisionrecord.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
$("#collisionRecordModalContent").html(data);
//initiate datepicker
$('#collisionRecordDate').datepicker({
endDate: "+0d"
endDate: "+0d",
format: getShortDatePattern().pattern
});
$('#collisionRecordModal').modal('show');
}
Expand All @@ -16,7 +17,8 @@ function showEditCollisionRecordModal(collisionRecordId) {
$("#collisionRecordModalContent").html(data);
//initiate datepicker
$('#collisionRecordDate').datepicker({
endDate: "+0d"
endDate: "+0d",
format: getShortDatePattern().pattern
});
$('#collisionRecordModal').modal('show');
}
Expand Down
6 changes: 4 additions & 2 deletions wwwroot/js/gasrecord.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
$("#gasRecordModalContent").html(data);
//initiate datepicker
$('#gasRecordDate').datepicker({
endDate: "+0d"
endDate: "+0d",
format: getShortDatePattern().pattern
});
$('#gasRecordModal').modal('show');
}
Expand All @@ -16,7 +17,8 @@ function showEditGasRecordModal(gasRecordId) {
$("#gasRecordModalContent").html(data);
//initiate datepicker
$('#gasRecordDate').datepicker({
endDate: "+0d"
endDate: "+0d",
format: getShortDatePattern().pattern
});
$('#gasRecordModal').modal('show');
}
Expand Down
6 changes: 4 additions & 2 deletions wwwroot/js/servicerecord.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
$("#serviceRecordModalContent").html(data);
//initiate datepicker
$('#serviceRecordDate').datepicker({
endDate: "+0d"
endDate: "+0d",
format: getShortDatePattern().pattern
});
$('#serviceRecordModal').modal('show');
}
Expand All @@ -16,7 +17,8 @@ function showEditServiceRecordModal(serviceRecordId) {
$("#serviceRecordModalContent").html(data);
//initiate datepicker
$('#serviceRecordDate').datepicker({
endDate: "+0d"
endDate: "+0d",
format: getShortDatePattern().pattern
});
$('#serviceRecordModal').modal('show');
}
Expand Down
6 changes: 4 additions & 2 deletions wwwroot/js/taxrecord.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
$("#taxRecordModalContent").html(data);
//initiate datepicker
$('#taxRecordDate').datepicker({
endDate: "+0d"
endDate: "+0d",
format: getShortDatePattern().pattern
});
$('#taxRecordModal').modal('show');
}
Expand All @@ -16,7 +17,8 @@ function showEditTaxRecordModal(taxRecordId) {
$("#taxRecordModalContent").html(data);
//initiate datepicker
$('#taxRecordDate').datepicker({
endDate: "+0d"
endDate: "+0d",
format: getShortDatePattern().pattern
});
$('#taxRecordModal').modal('show');
}
Expand Down

0 comments on commit 42f7bd2

Please sign in to comment.