Skip to content

Commit

Permalink
feat(luxon-getNow): Improve the response tz setting for obtaining t…
Browse files Browse the repository at this point in the history
…he current time method (#883)
  • Loading branch information
Wxh16144 authored Oct 17, 2024
1 parent a6db0d6 commit 826726b
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/generate/luxon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,14 @@ const normalizeLocale = (locale: string): string => locale.replace(/_/g, '-');

const generateConfig: GenerateConfig<DateTime> = {
// get
getNow: () => DateTime.local(),
getNow: () => {
/**
* The current time that can respond to tz settings is required. like `dayjs().tz()`.
* @see: https://github.com/ant-design/ant-design/issues/51282
* https://github.com/react-component/picker/pull/878
*/
return DateTime.now();
},
getFixedDate: (string) => DateTime.fromFormat(string, 'yyyy-MM-dd'),
getEndDate: (date) => date.endOf('month'),
getWeekDay: (date) => date.weekday,
Expand Down

0 comments on commit 826726b

Please sign in to comment.