-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
094cf30
commit bad53dd
Showing
7 changed files
with
180 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
# Hide generated files from PRs | ||
typedocs/* linguist-generated=true | ||
typedocs/**/* linguist-generated=true |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { describe, expect, it } from 'vitest'; | ||
import { getTestSiteThemeSDK } from './helpers'; | ||
import { | ||
DateFormats, | ||
} from '../src/types/helpers/datetime'; | ||
|
||
const sdk = getTestSiteThemeSDK(); | ||
|
||
describe('provideDateFormats', () => { | ||
it('should provide date formats', () => { | ||
expect(sdk.helpers.dateTime.dateFormats).toBe(DateFormats); | ||
expect(sdk.helpers.dateTime.dateFormats.weekdaySyearNmonthSdayNhourNminuteN) | ||
.toBe(DateFormats.weekdaySyearNmonthSdayNhourNminuteN); | ||
}); | ||
}); | ||
|
||
describe('localizeDate', () => { | ||
it('should localize date', () => { | ||
const date = new Date('2024-10-01T08:00:00.000-04:00'); | ||
let localizedDate = sdk.helpers.dateTime.localizeDate(date, 'en-US', sdk.helpers.dateTime.dateFormats.weekdayShort, 'America/New_York'); | ||
expect(localizedDate).toBe('Tue'); | ||
localizedDate = sdk.helpers.dateTime.localizeDate(date, 'en-US', sdk.helpers.dateTime.dateFormats.weekdayLong, 'America/New_York'); | ||
expect(localizedDate).toBe('Tuesday'); | ||
localizedDate = sdk.helpers.dateTime.localizeDate(date, 'en-US', sdk.helpers.dateTime.dateFormats.hourNminuteN, 'America/New_York'); | ||
expect(localizedDate).toBe('8:00 AM'); | ||
localizedDate = sdk.helpers.dateTime.localizeDate(date, 'en-US', sdk.helpers.dateTime.dateFormats.hourNminuteNsecondN, 'America/New_York'); | ||
expect(localizedDate).toBe('8:00:00 AM'); | ||
localizedDate = sdk.helpers.dateTime.localizeDate(date, 'en-US', sdk.helpers.dateTime.dateFormats.yearNmonth2day2, 'America/New_York'); | ||
expect(localizedDate).toBe('10/01/2024'); | ||
localizedDate = sdk.helpers.dateTime.localizeDate(date, 'en-US', sdk.helpers.dateTime.dateFormats.yearNmonthNdayN, 'America/New_York'); | ||
expect(localizedDate).toBe('10/1/2024'); | ||
localizedDate = sdk.helpers.dateTime.localizeDate(date, 'en-US', sdk.helpers.dateTime.dateFormats.yearNmonthLdayN, 'America/New_York'); | ||
expect(localizedDate).toBe('October 1, 2024'); | ||
localizedDate = sdk.helpers.dateTime.localizeDate(date, 'en-US', sdk.helpers.dateTime.dateFormats.yearNmonthSdayN, 'America/New_York'); | ||
expect(localizedDate).toBe('Oct 1, 2024'); | ||
localizedDate = sdk.helpers.dateTime.localizeDate(date, 'en-US', sdk.helpers.dateTime.dateFormats.yearNmonthLdayNhourNminuteN, 'America/New_York'); | ||
expect(localizedDate).toBe('October 1, 2024 at 8:00 AM'); | ||
localizedDate = sdk.helpers.dateTime.localizeDate(date, 'en-US', sdk.helpers.dateTime.dateFormats.yearNmonthSdayNhourNminuteN, 'America/New_York'); | ||
expect(localizedDate).toBe('Oct 1, 2024, 8:00 AM'); | ||
localizedDate = sdk.helpers.dateTime.localizeDate(date, 'en-US', sdk.helpers.dateTime.dateFormats.weekdayLyearNmonthLdayNhourNminuteN, 'America/New_York'); | ||
expect(localizedDate).toBe('Tuesday, October 1, 2024 at 8:00 AM'); | ||
localizedDate = sdk.helpers.dateTime.localizeDate(date, 'en-US', sdk.helpers.dateTime.dateFormats.weekdaySyearNmonthSdayNhourNminuteN, 'America/New_York'); | ||
expect(localizedDate).toBe('Tue, Oct 1, 2024, 8:00 AM'); | ||
localizedDate = sdk.helpers.dateTime.localizeDate(date, 'en-US', sdk.helpers.dateTime.dateFormats.weekdayLhourNminuteN, 'America/New_York'); | ||
expect(localizedDate).toBe('Tuesday 8:00 AM'); | ||
}); | ||
}); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.