I have a typescript file used to export some constant variables (export const). I would like to use datepipe to format date in the ts file, but I do not know how to add service to use datepipe in a non component ts file. For example: export const dateObject = [ { value: { start: new Date(), end: new Date().setFullYear(new Date().getFullYear() + 10), }, title: 'Ten Years Later' } ]; How can I make datepipe.transform(, 'yyyy-MM-dd') work in this typescript? Thank you!! Continue reading...