mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-03-15 12:29:16 +01:00
(bug) invalid month in some date format
This commit is contained in:
parent
44aae5e3f2
commit
66311b8761
@ -1,6 +1,7 @@
|
||||
# Changelog Fab-manager
|
||||
|
||||
- Updated shakapaker to 6.5.5
|
||||
- Fix a bug: invalid month in shown in date format
|
||||
- Fix a bug: new setups doesn't log
|
||||
|
||||
## v5.6.8 2023 January 26
|
||||
|
@ -54,9 +54,9 @@ export default class FormatLib {
|
||||
*/
|
||||
private static parseISOdate = (date: TDateISO|TDateISODate, res: Date = new Date()): Date => {
|
||||
const isoDateMatch = (date as string)?.match(/^(\d\d\d\d)-(\d\d)-(\d\d)/);
|
||||
res.setFullYear(parseInt(isoDateMatch[1], 10));
|
||||
res.setMonth(parseInt(isoDateMatch[2], 10) - 1);
|
||||
res.setDate(parseInt(isoDateMatch[3], 10));
|
||||
res.setMonth(parseInt(isoDateMatch[2], 10) - 1);
|
||||
res.setFullYear(parseInt(isoDateMatch[1], 10));
|
||||
|
||||
return res;
|
||||
};
|
||||
|
@ -8,11 +8,16 @@ describe('FormatLib', () => {
|
||||
const str = FormatLib.date(new Date('2023-01-12T12:00:00+0100'));
|
||||
expect(str).toBe('12/01/2023');
|
||||
});
|
||||
test('format an iso8601 short date', () => {
|
||||
test('format an iso8601 short date in french format', () => {
|
||||
Fablab.intl_locale = 'fr-FR';
|
||||
const str = FormatLib.date('2023-01-12');
|
||||
expect(str).toBe('12/01/2023');
|
||||
});
|
||||
test('format an iso8601 short date in canadian format', () => {
|
||||
Fablab.intl_locale = 'fr-CA';
|
||||
const str = FormatLib.date('2023-02-27');
|
||||
expect(str).toBe('2023-02-27');
|
||||
});
|
||||
test('format an iso8601 date', () => {
|
||||
Fablab.intl_locale = 'fr-CA';
|
||||
const str = FormatLib.date('2023-01-12T23:59:14-0500');
|
||||
|
Loading…
x
Reference in New Issue
Block a user