refactor(moment): Replace Moment.js with DayJs (#31310)

This commit is contained in:
Mehmet Salih Yavuz
2024-12-23 20:42:43 +03:00
committed by GitHub
parent b382ef1058
commit a193d790b2
41 changed files with 268 additions and 212 deletions

View File

@@ -18,7 +18,7 @@
*/
import { SafeMarkdown, styled, t } from '@superset-ui/core';
import Handlebars from 'handlebars';
import moment from 'moment';
import dayjs from 'dayjs';
import { useMemo, useState } from 'react';
import { isPlainObject } from 'lodash';
import Helpers from 'just-handlebars-helpers';
@@ -78,7 +78,7 @@ export const HandlebarsViewer = ({
// usage: {{dateFormat my_date format="MMMM YYYY"}}
Handlebars.registerHelper('dateFormat', function (context, block) {
const f = block.hash.format || 'YYYY-MM-DD';
return moment(context).format(f);
return dayjs(context).format(f);
});
// usage: {{ }}