This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Inject, Injectable, InjectionToken, LOCALE_ID, Optional } from '@angular/core'; | |
import { DateAdapter } from '@angular/material/core'; | |
import { DateTime, Info } from 'luxon'; | |
export const DATE_LOCALE = new InjectionToken<string>('DATE_LOCALE'); | |
/** Provider for MAT_DATE_LOCALE injection token. */ | |
export const DATE_LOCALE_PROVIDER = { provide: DATE_LOCALE, useExisting: LOCALE_ID }; | |
const ISO_8601_REGEX = /^\d{4}-\d{2}-\d{2}(?:T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|(?:(?:\+|-)\d{2}:\d{2}))?)?$/; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected string RenderRazorViewToString(string viewName, object model) | |
{ | |
ViewData.Model = model; | |
using (var sw = new StringWriter()) { | |
var viewResult = ViewEngines.Engines.FindPartialView(ControllerContext, viewName); | |
var viewContext = new ViewContext(ControllerContext, viewResult.View, ViewData, TempData, sw); | |
viewResult.View.Render(viewContext, sw); | |
viewResult.ViewEngine.ReleaseView(ControllerContext, viewResult.View); | |
return sw.GetStringBuilder().ToString(); | |
} |