dayjs Questions

6

I have the following problem: I am using ant.design in version 5.2.0. When I use the component as follows, I always get the attached error message when I pass a date to for the Form.Item in dayjs f...
Orthman asked 10/2, 2023 at 22:44

5

Solved

This is my logger.ts file that error happens there: import logger from "pino"; import dayjs from "dayjs"; const log = logger({ prettyPrint: true, base: { pid: false, }, ti...
Varicelloid asked 14/4, 2022 at 2:13

3

I'm experimenting with dayjs. Following the example in the documentation, I have set this in my HTML script: <script src="https://unpkg.com/[email protected]/dayjs.min.js"><...
Vinson asked 7/2, 2021 at 15:3

3

Solved

I have the following code import dayjs from 'dayjs' const abc = dayjs("09:00:00") console.log(abc) abc in console is how can I make this into a valid date, the condition being the in...
Cozen asked 15/1, 2021 at 22:23

3

Solved

Trying to migrate from Moment.js to Dayjs but the only thing I can't get working is the Timezone abbreviation. dayjs('2020-07-06T14:30:00.000-04:00').tz(dayjs.tz.guess()).format('Do MMM YYYY [at] H...
Lecithinase asked 20/9, 2020 at 8:22

3

Solved

I am getting this error dayjs.utc is not a function Here is my code const dayjs = require('dayjs') console.log('utc time',dayjs.utc())
Advertising asked 29/12, 2022 at 8:47

2

DayJs Using it on the browser if that matters (firefox + Vue + typescript). This is my date string 2021-02-05 12:00 AM It fusses about the AM/PM in my code: const dateObj: any = dayjs('2021-02-05...
Warplane asked 22/1, 2021 at 5:5

2

I was recently using momentjs but just switched to dayjs. However, I need to get a list of timezones. With momentjs it was pretty simple : moment.tz().names() , but with dayjs I can't figure out ho...
Hendrix asked 26/8, 2022 at 7:16

2

I upgraded the Ant Design version from 4 to 5 and replaced Moment with Day.js, then encountered this error. const { field, fieldState: { error }, } = useController({ name: name, control: control...
Meshwork asked 10/7, 2023 at 2:51

2

I'm quite new to Angular and within our project, we switched recently to Angular 14.2.12. We use moment.js for time based calculation and date time parsing. But after switching to Angular 14, we go...
Werby asked 23/2, 2023 at 11:44

2

Solved

I'd like to sort out a dayjs problem I am experiencing. Right now, I'm out of clues and/or guesses of what can happen, apart from the bad timezone setting. But again, how could timezone play a role...
Sucker asked 19/3, 2021 at 9:25

2

Solved

I am getting this error. TypeError: dayjs(...).tz is not a function My code is const dayjs = require('dayjs'); const dayjsAmerica = dayjs("2014-06-01 12:00").tz("America/New_York&quo...
Sauerbraten asked 13/12, 2022 at 5:26

3

Solved

I wanna calculate the difference between the two dates with dayjs library. it works nice but I need to something different a little bit. For example: `${dayjs(item).diff(now, 'day') day}` this fun...
Paul asked 15/3, 2021 at 14:21

2

So I'm trying to show locale of German in my React app with dayjs but is not working, here is my code, i tried to add locale('de') but that is not doing the job, so i don't know what to try next. I...
Leath asked 7/5, 2022 at 8:34

5

Solved

I have this dayjs objects: const today = dayjs.utc(date).startOf("day") I am trying to mock it using jest but to no avail. Here is the approach I tried: jest.mock("dayjs", () =&...
Gessner asked 14/7, 2020 at 15:14

4

Solved

I have two inputs of time and I want to get the difference/time-interval between these two using dayjs fromtime = '13:00' totime = '17:00' So the output for the above two should be 4:00 hours I...
Mufti asked 14/2, 2020 at 12:9

3

Solved

In my code that needs testing I use import dayjs from 'dayjs'; import utc from 'dayjs/plugin/utc'; dayjs.extend(utc); dayjs().add(15, 'minute') In my test I need to mock dayjs in order to always ...
Witherite asked 3/12, 2020 at 17:3

4

Problem Calling dayjs() results in a date that is correct except it is off by two hours. For some reason, dayjs() seems to be set to the wrong time zone (GMT), when my actual time zone is GMT+2. Ex...
Stlouis asked 9/8, 2021 at 16:31

6

Solved

I'm trying to convert a date from my local time (Taipei UTC+8) to Los Angeles ( UTC-7) however dayjs conversion seems to be completely off : dayjs("2020-09-21 20:30").tz("Asia/Taipei...
Wehrle asked 22/9, 2020 at 9:35

1

Solved

I am using the ant-design date picker component with dayjs as the date library. The component is controlled with the initial value being null and the value changes to dayjs object based on some ope...
Chest asked 12/10, 2022 at 16:31

2

I'm passing two dayjs date to Vars.date global variables. var dayjs = require("dayjs") for import Vars.date1 = dayjs(whateverdate1("add", 2)).format('MMM D, YYYY') Vars.date2 ...
Placebo asked 5/2, 2022 at 6:42

2

Solved

I am currently stuck on how to do validation with yup for same date. Currently I am able to validate if endDate is not before startDate using : schema = yup.object().shape({ startDate: yup.date()....
Frequentative asked 16/11, 2021 at 7:12

1

I am using dayjs library's duration object for duration format. dayjs.duration(1500, 'minutes').format('H[h] m[m]') // returns 1h 0m Seems the library converts the 24hrs to 1 day and puts the rema...
Pouched asked 6/2, 2022 at 6:22

4

Solved

I am able to use dayjs inside vue3 component by adding it to data() import dayjs from 'dayjs' export default { data() { return { dayjs } } } Then I will be able to use it inside template but...
Immortelle asked 10/3, 2021 at 6:17

1

Solved

I am building a calendar component in React without using any library but Day.js. I need to detect the first weekday of the month in order to leave a gap as shown in the picture. Otherwise the firs...
Justle asked 30/8, 2021 at 23:57

© 2022 - 2025 — McMap. All rights reserved.