Skip to content

Instantly share code, notes, and snippets.

@seanogdev
Created November 21, 2020 01:53
Show Gist options
  • Save seanogdev/16ec23c7c5a576cd9fc1fe0a29e74e16 to your computer and use it in GitHub Desktop.
Save seanogdev/16ec23c7c5a576cd9fc1fe0a29e74e16 to your computer and use it in GitHub Desktop.
Override Luxon formatters example
import { DateTime } from 'luxon';
export default class CustomLuxonDateTime extends DateTime {
toISO(opts = {}) {
if (!this.isValid) {
return null;
}
const timeOpts = {
suppressMilliseconds: true,
...opts,
};
return `${this.toISODate(opts)}T${this.toISOTime(timeOpts)}`;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment