Skip to content

Instantly share code, notes, and snippets.

@luebster
Created July 20, 2022 20:16
Show Gist options
  • Save luebster/1e8a1bbc49157cde608858abaa80906e to your computer and use it in GitHub Desktop.
Save luebster/1e8a1bbc49157cde608858abaa80906e to your computer and use it in GitHub Desktop.
DataFormatString for passing value to Flatpickr
$(".datePicker").flatpickr({
enableTime: true,
altInput: true,
altFormat: "n-j-Y h:i K"
});
<input class="input datePicker" type="text" asp-for="FormModel.PublishDate" />
public class AddArticle
{
---
[Display(Name = "Publish Date")]
[DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:yyyy-M-d HH:mm}")]
public DateTime? PublishDate { get; set; }
---
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment